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
1650
Wingrid Layouts; Creating new layouts from existing
posted

I have an application where the user has the ability to save multiple layouts. By default I save a single default layout in the DB. The first time the user logs in, the default layout is used.  However this causes a delay in loading.

Each grid in my application has what we call a RepNumber. The filterrow contains the column for repname, which is tied to the repnumber.  What I would like to do is create a layout for each user when I save the default layout for the first time. 

How can I take an existing layout and create a default that is catered to each specific user? Also, when ever a new user is added to the system, I would need to create the default layout records for that user.

My initial thoughts where to have the db triggers perform these function, but I dont know how to add filters to an existing layout.

By the way I am serializing the layouts with XML...

 

Thanks

Parents
No Data
Reply
  • 28407
    posted

    HI Elfmanne,

     I created a sample application that creates several different wingrid layouts, each with different filtering conditions. I then apply these layouts to several different grids.

    Here is a code snippet to create the layouts with different filtering 

               UltraGridBand band = ultraGrid1.DisplayLayout.Bands[0];
          
                band.ColumnFilters[0].FilterConditions.Add(FilterComparisionOperator.Equals, 2);
                ultraGrid1.DisplayLayout.SaveAsXml("Acct2.xml");


                band.ColumnFilters[0].ClearFilterConditions();
                band.ColumnFilters[0].FilterConditions.Add(FilterComparisionOperator.Equals, 3);
                ultraGrid1.DisplayLayout.SaveAsXml("Acct3.xml");

     

      Here is a code snippet load the layouts

           ultraGrid2.DisplayLayout.LoadFromXml("Acct2.xml");
                ultraGrid3.DisplayLayout.LoadFromXml("Acct3.xml");
                ultraGrid4.DisplayLayout.LoadFromXml("Acct4.xml");
                ultraGrid5.DisplayLayout.LoadFromXml("Acct5.xml");

     The sample project is too large to attach to this forum post. I will email it to you directly.

      Please review my sample application. You will need to readd the Infragistics references to run this project.

     Sincerely,

     Matt

    Developer Support Engineer

     

     

Children