Change Column index/display index?

7 posts, 0 answers
  1. Steven
    Steven avatar
    1 posts
    Member since:
    Apr 2013

    Posted 11 Apr 2013 Link to this post

    Hi guys,

    Just wandering is is possible to change the grid views Column index's? or Possible to change the display, heck even both.

    Typically in Winforms i use  the code below.

    Hoping this is just a syntax lack of knowledge for Telerik controls.

    Many thanks in advanced guys!
    dgv_Pareto.Columns["Pg"].DisplayIndex = 0;
    dgv_Pareto.Columns["Part"].DisplayIndex = 1;

  2. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 15 Apr 2013 Link to this post

    Hi Steven,

    Thank you for writing.

    You can move the columns in RadGridView by using the Move method of the Columns collection:
    radGridView1.Columns.Move(radGridView1.Columns["ColumnToMove"], 2);

    I hope this helps. 

    Kind regards,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  3. Marc
    Marc avatar
    2 posts
    Member since:
    Jun 2017

    Posted 05 Sep 2017 Link to this post

    Hi Stefan,

    How i can get the display index of the column?

    I need get this for save order columns and replicate after.

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3424 posts

    Posted 05 Sep 2017 Link to this post

    Hello Marc, 

    Thank you for writing.  

    Each column has Index property which indicates the position. However, in order to keep the columns order, it is suitable to use save/load layout. Additional information is available in the following section in the documentation: http://docs.telerik.com/devtools/winforms/gridview/save-and-load-layout/save-and-load-layout

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Progress Telerik
    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.
  5. Aseman
    Aseman avatar
    9 posts
    Member since:
    Aug 2019

    Posted 10 Sep in reply to Stefan Link to this post

    Does Column in Rad GridView, have property for setting Column Index?

    for Example: 

    RadGridView .column[0].Index=2;

     

    so How can I Do it?

  6. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3424 posts

    Posted 11 Sep Link to this post

    Hello, Aseman,

    The GridViewColumn offers a public Index property indicating the position of the column in the Columns collection of the OwnerTemplate.

    int columIndex = this.radGridView1.Columns["ProductName"].Index;

    I hope this information helps.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  7. dina
    dina avatar
    1 posts
    Member since:
    Jun 2018

    Posted 06 Oct in reply to Stefan Link to this post

    thanks, it worked for me
Back to Top