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

[Solved] Radgrid autogenerated column - hide column

3 Answers 1330 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kachy
Top achievements
Rank 1
kachy asked on 12 Aug 2009, 12:17 PM
I have a radgrid with autogenerated columns. I hide one column when the grid is created. I see the hidden column name in the columnheader context menu, if I try to show the hidden column, it does not show properly. I am hiding the column in radgrid columncreated server side event  by making the display false for that particular column.
Is there another way to hide the column, may be in any client side event after the radgrid loads properly server side, so that the hidden column shows properly from the column header context menu?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 13 Aug 2009, 07:41 AM
Hello Kachy,

You can hide the autogenerated  column using its UniqueName which would be same as the DataField of the column:
C#:
protected void RadGrid1_PreRender1(object sender, EventArgs e)    
    {    
        RadGrid1.MasterTableView.GetColumn("TitleOfCourtesy").Visible = false;    
    } 

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
kachy
Top achievements
Rank 1
answered on 13 Aug 2009, 01:23 PM

I have tried doing the same thing this way but  it also gives me the same result, when I try to show this hidden column from column context menu, it does not show properly and also as this prerender event runs everytime I sort or do any action which prerenders the grid, hides it again.

protected

 

void RadGridReportWeek_PreRender(object sender, EventArgs e)

 

{

 

if( RadGridReportWeek.MasterTableView.RenderColumns.Length > 4 )

 

{

RadGridReportWeek.MasterTableView.RenderColumns[4].Display =

false;

 

}

}

Can I hide the column client side, once its rendered properly on server side, so that the width and other formatting are proper when shown from ContextMenu.
something like this:

 

var

 

masterTable = $find("<%=RadGridReportWeek.ClientID%>").get_masterTableView();

 

 

var column = masterTable.getColumnByUniqueName("EnrollmentDate");

 

masterTable.hideColumn(column.get_element().cellIndex);

Thanks

 

 

 

0
Pavlina
Telerik team
answered on 14 Aug 2009, 12:50 PM
Hi Kachy,

Please review the following thread which elaborate on this subject and let me know if it works for you.
http://www.telerik.com/community/forums/aspnet-ajax/grid/could-not-able-hide-the-column.aspx
Additionally if the issue still persist it will be best if you open a formal support ticket and send us a simple working project that demonstrates the problem, so we can check it locally and advise you further.

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
kachy
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
kachy
Top achievements
Rank 1
Share this question
or