I have some grid applications that use .lyt layout files to reconfigure the grid based on user input.
What I do currently is put a layout folder into the click once deployment folder on the server. I then put the path to the layout folder into the application. Our application server is failing and I need to move all of my apps to a new server. All of the path strings have to be updated. Is there a better way to reference the grid layout files without hard coding the path into the application ie. Application.StartupPath in .net.
Thanks
Roger
Hi Roger,
Are these layouts defined by you, or by the user?
If they are defined by you, then you could include the layout files in your application as embedded resources, rather than as separate files.
These are layouts I've set up and saved. I haven't needed to use the embedded resource files, but that sounds like a good solution.
Thanks for getting me pointed in the right direction.
Hi,
What exactly do you mean by "stored on the server outside of the application folders"? What kind of server is this?
My guess is that the way you are referencing the file is incorrect in some way. I expect that using the string you have here as a filename, the DotNet Framework will try to fine a folder relative to the current application folder. But it's really difficult to guess without more information.
Loading a layout in the grid and loading a file into the StyleManager use basically the same code. They both attempt to load the file into a FileStream. So I can't see why there would be any difference between the two that would account for the difference in behavior unless there's something different about the way you are specifying the path. Or perhaps the difference is the location of the code?
Hi Mike,
I have successfully embedded grid layouts and now I am trying to do the same with AppStyling.
I have this code at the top of the form code.
'*******************************************************************
Public
Sub New()
MyBase.New()
InitializeComponent()
Infragistics.Win.AppStyling.StyleManager.Load("Server\
Status Reports\Layouts\TacApps2.isl")
End Sub
'***********************************************************************************
The TacApps2.isl designer file is stored on the server outside of the application folders.
When I embed the App Styling file in the same way that I handle the grid layout file, the application fails when I try to start it.
It works fine if the App Styling is not embedded.
Any ideas?
Thanks Mike. I'll try it today.
Here's what you do.
To access the layout in code, you do something like this:
Stream stream = this.GetType().Module.Assembly.GetManifestResourceStream("Layout.lyt"); this.ultraGrid1.DisplayLayout.Load(stream);
The trickiest part of this, in my opinion, is determining the string to use for the name of the layout file. You have to use the name of the project or namespace to preface it, and you also have to include any sub-folders that you used when you added the layout to the project.
If you have trouble getting this to work, what I like to do is just have the project list all of the resource names so I can find the exact string I need:
string[] resourceNames = this.GetType().Module.Assembly.GetManifestResourceNames(); foreach (string resourceName in resourceNames) Debug.WriteLine(resourceName);
I can't seem to connect the concepts of text or bmp embedded resources with infragistics layout files. I need some help on how to embed the laypout in the project.