Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
510
Save DisplayLayout in UltraWinGrid
posted

Hi

I am having an issue while saving the layout of the grid.

Following is the code I am using to save the layout:

private  void SaveGridLayout(object sender, EventArgs  e)
{
UltraGrid grid = (UltraGrid)sender;
grid.DisplayLayout.SaveAsXml(
Application.StartupPath + "\\GridSettings\\" + grid.Name + ".xml", PropertyCategories.All);

if (File.Exists(Application.StartupPath + "\\GridSettings\\" + grid.Name + ".xml"))
{
grid.DisplayLayout.LoadFromXml(
Application.StartupPath + "\\GridSettings\\" + grid.Name + ".xml", PropertyCategories.All);
}
}

What is happening I am having an image inside one of the column. I am using the following code to show the image in the grid, which is coming from a Database as byte[].

Infragistics.Win.EmbeddableImageRenderer imgEditor = new Infragistics.Win.EmbeddableImageRenderer();

imgEditor.ScaleImage = Infragistics.Win.

ScaleImage.Always;
UltraGridBand band = ugPatients.DisplayLayout.Bands[0];
band.Columns[
"PatientImage"].Editor = imgEditor;

Now after saving the layout when next time the column shows byte[] array instead of the image, I think the grid loosing the embeddableImageRender that is assigned to the column.

Is there a solumn by which I can get rid of this issue.

Thanks and Regards
Pradeep

  • 469350
    Suggested Answer
    Offline posted

    H iPradeep,

    I don't beleive the EmbeddableImageRenderer is serializable, so it can't be saved with the layout.

    What you should do is apply the Editor inside the grid's InitializeLayout event so that it will always get applied every time the grid's DataSource changes or a layout is loaded.