This is a migrated thread and some comments may be shown as answers.

RadGrid loop column and hide

6 Answers 193 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kenneth
Top achievements
Rank 1
kenneth asked on 25 Oct 2011, 09:31 AM
Is it possible to loop thru all the columns in a grid and get all the column names, and allocate those columns with empty header name, and hide from grid.

6 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 25 Oct 2011, 10:10 AM
Hello,

protected void RadGrid1_PreRender(object sender, System.EventArgs e)
   {
       foreach (GridColumn column in RadGrid1.Columns)
       {
           if (string.IsNullOrEmpty(column.HeaderText))
           {
               column.Visible = false;
           }
       }
       RadGrid1.Rebind();
   }



Thanks,
Jayesh Goyani
0
kenneth
Top achievements
Rank 1
answered on 25 Oct 2011, 11:17 AM
But if rebind, all my selected for checkboxes will be reset back to null. I need to keep those selected check as well.~
0
Jayesh Goyani
Top achievements
Rank 2
answered on 25 Oct 2011, 11:57 AM
Hello,

Then try with ColumnCreated event.

http://www.telerik.com/help/aspnet/grid/grdusingcolumns.html

Let me know if any concern.

Thanks,
Jayesh Goyani
0
kenneth
Top achievements
Rank 1
answered on 25 Oct 2011, 12:09 PM
Hi,

another question, can i merge the item cell?  like column 1 and column 2 merge into one, or without the center border.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 25 Oct 2011, 04:58 PM
Hello,

Please check Contact details column in below link.
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/columntypes/defaultcs.aspx


Thanks,
Jayesh Goyani
0
kenneth
Top achievements
Rank 1
answered on 26 Oct 2011, 03:53 PM
I would like to merge last 2 columns Can i invoke merge cell in code behind? Thanks Also. Can i get last column count where the column is Visible. Thanks in advance
Tags
Grid
Asked by
kenneth
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
kenneth
Top achievements
Rank 1
Share this question
or