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
120
Can I change the grid column name at runtime?
posted

Hi.

Is it possible for me as a user to change the column names/titles while the application is running. Something like a rename/edit feature. And if yes, can these updated column names be persisted (maybe in xml file or resource) so that they can be reused when the application starts again.

Appreciate your help.

Thanks.

  • 12773
    posted

    Hello,

    Generally you can chose which information want to save to that XML but, you don’t have possibility to chose all the properties you have set in the grid.

    You can use PropertyCategories enumeration on order to set the categories you want to save , and I believe you can use “Bands”, since I suppose you are not using UnboundCoumns. You can find more information here :
    http://help.infragistics.com/Help/NetAdvantage/WinForms/2009.1/CLR2.0/html%5CInfragistics2.Win.UltraWinGrid.v9.1~Infragistics.Win.UltraWinGrid.PropertyCategories.html
    and
    http://help.infragistics.com/Help/NetAdvantage/WinForms/2009.1/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v9.1~Infragistics.Win.UltraWinGrid.UltraGridLayout~SaveAsXml(Stream,PropertyCategories).html
    I hope this information was helpful.

    Sincerely,
    Dimi
    Developer Support Engineer
    Infragistics, Inc.

  • 12773
    Suggested Answer
    posted

    Hello,

    Yes you can change the column name runtime using the caption property of the column you want to rename:

    this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Header.Caption. = "Test";

     And yes you can use Save Layouts - SaveAsXml and Load Layout - LopadFormXml in order to get the changes that you make in your grid. And when you run you application and load the saved layout, the changes will be appear in the grid.

    See more details here:
    http://help.infragistics.com/Help/NetAdvantage/WinForms/2009.1/CLR2.0/html%5CWinGrid_Save_and_Load_a_Layout_to_a_File.html

    I hope this is helpful.

    Sincerely,
    Dimi
    Developer Support Engineer
    Infragistics, Inc.