Hi,
I've a problem with radGrid.
If I hide a column in PreRender event using Me.Grid1.MasterTableView.RenderColumns(3).Visible = False, when I try to retreive the value in ItemDataBound event, the value is
If the column is visible, the value is shown correctly.
I've recently updated Telerik from 2009.3.1314.35 to 2014.3.1209.35.
Before this update, everything was working well
I work with VS 2013.
Any ideas?
Thanks
5 Answers, 1 is accepted
I found a solution by myself:
in the ItemDataBound event, I can use e.Item.DataItem(..columnname..) instead of e.item.cells(3).text, where 3 is the index of "columnname".
Even if the column is hidden, the DataItem is populated correctly.
But if there is a better solution....
Thanks
Davide
If you update to our latest versions you could add the following in your web.config file and it will revert back the previous behavior of the hidden columns:
<
appSettings
>
<
add
key
=
"BindGridInvisibleColumns"
value
=
"true"
/>
Another option is to set the Display property of the column to "false", instead of the Visible property.
Regards,
Konstantin Dikov
Telerik by Progress
Wow Konstantin, your web.config solution works well!!!!
Before my post, I tried to use display instead of visible without results.
But inserting the new key in web.config as you suggested, the grid works correctly as previous Telerik version!
Thank you very much.
Davide
Hi Telerik Team,
Adding this config is the right solution? and are we missing any performance improvement done in latest releases?
What is better solution except this config change?
We are upgrading RadControls 2011 to 2017
Regards
Bala
You can find detailed info about this improvement in the following post:
http://www.telerik.com/forums/breaking-change-hidden-column-cell-text-is-not-persisted-in-viewstate
Here is a clarification about the Visible and Display properties:
1. When hiding a column using Visible="false", it won't be rendered at all. No info is sent about this column to the client-side. To make it visible again, you will need to make a PostBack or AJAX request back to the server.
2. Setting Display="false" on the other hand, will hide the column only visually. All column related data and field values will be present on the client-side and you can show the column using javascript without posting back to the server.
To access record values on code-behind, which are not displayed to the user, you can use e.Item.DataItem object during the ItemDataBound event handler or the DataKeyNames collection of the MasterTableView tag in combination with GetDataKeyValue method. These approaches are explained with examples in the following section:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-raw-field-data-and-key-values
I hope this will prove helpful.
Regards,
Eyup
Telerik by Progress