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

GridBoundColumn

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 2
Jim asked on 21 Aug 2008, 01:12 PM
I have a grid that I create about 6 grid bound columns for.  I fire off the oncolumncreated event to hide and unhide two columns depending on the data being displayed.  The problem is the examples I have found show changing GridBoundColumn display or visibility setting, but when I stop the code execution during the event all of the columns are Expand Columns?  Here are my grid settings:

<

telerik:RadGrid ID="rgLG"

runat="server"

EnableEmbeddedSkins="false"

AutoGenerateColumns="false"

Visible="true"

OnNeedDataSource="rgLG_OnNeedDataSource"

Skin="Report"

EnableLinqExpressions="false"

AllowSorting="false"

ShowStatusBar="false"

AllowPaging="false"

onitemcommand="rgLG_ItemCommand"

oncolumncreated="rgLG_ColumnCreated" >

<MasterTableView AllowSorting="true"

AlternatingItemStyle-BackColor="Gray"

CommandItemDisplay="Top"

DataKeyNames="LG_ID" >

Thanks jim

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Aug 2008, 01:40 PM
Hello Jim,

You can try the following code (on Load/PreRender event) when you are not using auto generated columns.
foreach (GridColumn column in rGrid.MasterTableView.RenderColumns) 
    if (column.UniqueName == "Address"
        column.Visible = false

Greetings,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Jim
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Share this question
or