How to Saving grid settings on a per user basis

13 posts, 0 answers
  1. Nikhil Jain
    Nikhil Jain avatar
    25 posts
    Member since:
    Aug 2009

    Posted 21 Jan 2011 Link to this post

    Hi

    I want to know how can I Saving grid settings (Reordering of Grid Column)  on a per user basis.

    Regards
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 21 Jan 2011 Link to this post

    Hello,

    Have you checked this demo

    All the best,
    Vlad
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Nikhil Jain
    Nikhil Jain avatar
    25 posts
    Member since:
    Aug 2009

    Posted 25 Jan 2011 Link to this post

    This demo, is not showing how to save settings for a RadGrid when user Reorders the columns.!
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 25 Jan 2011 Link to this post

    Hi Nikhil Jain,

    You may expose a new property in the ColumnSettings class - DisplayIndex for example that save the original DisplayIndex property of each column.
     

    Best wishes,
    Maya
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  6. Nikhil Jain
    Nikhil Jain avatar
    25 posts
    Member since:
    Aug 2009

    Posted 27 Jan 2011 Link to this post

    Thanks for your reply.!
    If you provide me sample that would me great and more helpful for me.
  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 27 Jan 2011 Link to this post

    Hi Nikhil Jain,

    May you take another look at our demos considering the Save and Load RadGridView Layout Settings ? The ColumnSetting class exposes the above-mentioned property - DisplayIndex that keeps the value of the DisplayIndex property of each column. Consequently, once you reorder the columns, their index will be save and loaded again afterwards. Do you have any troubles with this particular example ? 

     

    Regards,
    Maya
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  8. Nikhil Jain
    Nikhil Jain avatar
    25 posts
    Member since:
    Aug 2009

    Posted 27 Jan 2011 Link to this post

    Hi Maya

    I am having an Error message : "GridViewDataControl_ColumnDisplayIndexOutOfRange Sales Use
    Parameter name: displayIndex"
    public class ColumnSetting : PropertySetting
       {
           public string UniqueName { get; set; }
           public object Header { get; set; }
           public double? Width { get; set; }
           public int DisplayIndex { get; set; }
       }


    foreach (ColumnSetting setting in Settings.ColumnSettings)
                        {
                             
                            GridViewDataColumn column = new GridViewDataColumn();
                            column.UniqueName = setting.UniqueName;
                            column.Header = setting.Header;
                            column.DisplayIndex = setting.DisplayIndex;
                            if (setting.Width != null)
                            {
                                column.Width = new GridViewLength(setting.Width.Value);
                                  
                            }
      
                            grid.Columns.Add(column);
                        }
  9. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 27 Jan 2011 Link to this post

    Hello Nikhil Jain,

    May you take another look at our demos considering the Save and Load RadGridView Layout Settings and implement the code for the LoadState() method ? The code from the demo corresponding to the one you posted is:
    if (this.grid != null)
               {
                   grid.FrozenColumnCount = Settings.FrozenColumnCount;
     
                   if (Settings.ColumnSettings.Count > 0)
                   {
                       foreach (ColumnSetting setting in Settings.ColumnSettings)
                       {
                           ColumnSetting currentSetting = setting;
     
                           GridViewDataColumn column = (from c in grid.Columns.OfType<GridViewDataColumn>()
                                                        where c.UniqueName == currentSetting.UniqueName
                                                        select c).FirstOrDefault();
     
                           if (column != null)
                           {
                               if (currentSetting.DisplayIndex != null)
                               {
                                   column.DisplayIndex = currentSetting.DisplayIndex.Value;
                               }
     
                               if (setting.Width != null)
                               {
                                   column.Width = new GridViewLength(setting.Width.Value);
                               }
                           }
                       }
                   }

    This code is created against our current official release Q3 2010 SP1. What version of RadControls are you using ? 
    Still, I am sending you a sample project that you may use for a reference and testing the functionality locally. 

     

    Regards,
    Maya
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  10. Remco
    Remco avatar
    2 posts
    Member since:
    Dec 2011

    Posted 20 Nov 2012 Link to this post

    Hello i try to do this with the actual 2012Q3, But i am unable to compile the SaveAndLoadSettings project that is attached in the last post and i can also not find the SaveAndLoad sample in the 2012Q3 Demosets..

    Can you give me a updated solution? thanks

  11. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 20 Nov 2012 Link to this post

    Hi,

     With 2012 Q3 you should use our Persistence Framework:
    http://demos.telerik.com/silverlight/#PersistenceFramework/GridViewCustomSerialization

    All the best,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  12. Issac
    Issac avatar
    4 posts
    Member since:
    Aug 2016

    Posted 05 Aug in reply to Vlad Link to this post

    Hello Vlad,

    Is there anyway to save the GridViewSettings to XML format? As I realised those demo it only save for temporary usage after I closed the application it couldn't load the settings I saved earlier. I hope there is an example which could save the gridview settings to XML format so it could load the XML settings based on each user log in. Sorry I'm new in development so hope you don't mind.

  13. Stefan X1
    Admin
    Stefan X1 avatar
    517 posts

    Posted 08 Aug Link to this post

    Hello Issac,

    I am attaching a sample application demonstrating how RadGridView can be persisted in an xml file. Can you please check it out?

    I hope it helps.

    All the best,
    Stefan X1
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  14. Issac
    Issac avatar
    4 posts
    Member since:
    Aug 2016

    Posted 09 Aug in reply to Stefan X1 Link to this post

    Hello Stefan,

    Thanks for the sample but it couldn't run cause some of dlls is missing but is okay. I just look through the classes.

    From
    Issac
Back to Top
UI for WPF is Visual Studio 2017 Ready