This is a migrated thread and some comments may be shown as answers.

Save Layout for more than one grid view

2 Answers 43 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ammar
Top achievements
Rank 1
Ammar asked on 28 Mar 2017, 03:57 PM

Hello dear,

I can save layout for more than one grid view in the same file ??, for example:

i have gv1 and gv2, i want to save layout for all grids in one file so i can do this ?? if yes let me know, thanks.

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 29 Mar 2017, 06:06 AM
Hello Ammar,

You can manually save the layouts to a string and then add them to a file. Then you can separate the layouts and load them. Here is how you can save/load the layout using a string:
string layout;
private void RadMenuItem3_Click(object sender, EventArgs e)
{
    StringBuilder sb = new StringBuilder();
    sb.AppendLine("###Grid");
    using (XmlWriter writer = XmlWriter.Create(sb))
    {
 
        radGridView1.SaveLayout(writer);
    
    }
    layout = sb.ToString();
      
}
 
private void radMenuItem2_Click(object sender, EventArgs e)
{
    layout = layout.Split(new string[] { "###Grid" }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault().Trim();
    using (XmlReader reader = XmlReader.Create(new System.IO.StringReader(layout)))
    {
        radGridView1.LoadLayout(reader);
    }
}

I hope this will be useful. 

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Ammar
Top achievements
Rank 1
answered on 29 Mar 2017, 09:52 AM

Hello Dimitar's,

 

thanks for your assistance, i will try your code and update you as soon as possible, regards.

Tags
GridView
Asked by
Ammar
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Ammar
Top achievements
Rank 1
Share this question
or