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

hide column in RadGrid

4 Answers 936 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zohreh
Top achievements
Rank 1
Zohreh asked on 07 Apr 2013, 01:22 PM
hello dear,
how can i Hide a colum with all data in several rows.
Below syntax hide header text only and don't hide data in row that related to hidden column.
 
WBSRadGrid.MasterTableView.GetColumn("ActualEndDate").Visible =false; 

best regards,
zohreh

4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 07 Apr 2013, 02:16 PM
Hello,

<telerik:GridBoundColumn DataField="ID" UniqueName="ActualEndDate" HeaderText="ID">
                   </telerik:GridBoundColumn>

WBSRadGrid.MasterTableView.GetColumn("ActualEndDate").Visible = false;
//or
            WBSRadGrid.MasterTableView.Columns.FindByUniqueName("ActualEndDate").Visible = false;

Please write  above code snippet in either Pge_PreRender or Radgrid_Prerender event.

Thanks,
Jayesh Goyani
0
Zohreh
Top achievements
Rank 1
answered on 09 Apr 2013, 06:00 AM
hello Jayesh,
i write your code, but header text hide and data in parent  column hide only but in child not hide.
what should i do?

<telerik:GridBoundColumn DataField="ActualStartDate" UniqueName="ActualStartDate" HeaderText="Actual Start Date"></telerik:GridBoundColumn>

        protected void WBSRadGrid_PreRender(object sender, EventArgs e)
        {
            WBSRadGrid.MasterTableView.GetColumn("ActualStartDate").Visible = _ShowActualStartDate;
            WBSRadGrid.MasterTableView.Columns.FindByUniqueName("ActualStartDate").Visible = _ShowActualStartDate;
please help.
Best regards,
Zohreh
0
Zohreh
Top achievements
Rank 1
answered on 15 Apr 2013, 07:09 AM
hello dear,
i should complete my question,
i had a radgrid self-referencing hierarchy and want hide a column in rad gird when i used command below WBSRadGrid.MasterTableView.GetColumn("ActualStartDate").Visible = _ShowActualStartDate;

it only hide column in header and in main parent but in children i saw ithat column yet.
what should i do for hide column in children?

please help me.
please

best regards,
zohreh
 
0
Shinu
Top achievements
Rank 2
answered on 15 Apr 2013, 08:08 AM
Hi,.

I was able to hide the column in prerender event. One suggestion is you can hide the column as shown below.
c#:
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
   {
       if (e.Column.UniqueName == "Uniquename")
       {
          e.Column.Visible = false;
       }
   }

Thanks,
Shinu
Tags
Grid
Asked by
Zohreh
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Zohreh
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or