Getting RadGrid Column Header order.

4 posts, 1 answers
  1. omm
    omm avatar
    8 posts
    Member since:
    Apr 2010

    Posted 13 Jul 2010 Link to this post

    Hi,

    How can i able to get the order of Column headers in rad grid.

    grdtst.HeaderRow.Cells[i].Text; - this is the way we get header row text from ASP.NET Gridview but in RadGrid i didnt found any option like this.

    please help me out of this.

    Thanks in adv
    -- omm --
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Jul 2010 Link to this post

    Hello,

    You could use the ColumnUniqueName property in order to identify the cell of interest.

    Server code:
    GridHeaderItem headerItem = RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem;
    // fetch the data with headerItem["ColumnUniqueName"].Text

    Accessing cells and rows

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. omm
    omm avatar
    8 posts
    Member since:
    Apr 2010

    Posted 21 Jul 2010 Link to this post

    hello shinu,

    Thanks for ur answer... but still my problem has not been solved because i used looping to go through each column and accessing the headers, according to my code it is giving only the static columns created in ItemTemplate is only coming in count,  is there any way to get the count of all the columns (static and dynamically loaded columns). please refer the code i have used;

    StringBuilder

     strbldr = new StringBuilder();

     

     

    for (int i = 0; i < RadGrid2.Columns.Count; i++)

     

    {

    strbldr.Append(RadGrid2.Columns[i].HeaderText.ToString());

    strbldr.Append(

    ",");

     

    }

     

    return strbldr.ToString();

     

  5. Answer
    Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 26 Jul 2010 Link to this post

    Hello Om,

    Please try the following:
    foreach (GridColumn column in RadGrid1.MasterTableView.RenderColumns)
    {
        if(!(column is GridRowIndicatorColumn || column is GridExpandColumn || column is GridGroupSplitterColumn))
        {
            column.HeaderText...           
        }
    }

    Regards,
    Daniel
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top