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

Invisible column loses value

5 Answers 280 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Davide
Top achievements
Rank 1
Davide asked on 20 Jul 2016, 01:38 PM

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

Sort by
0
Davide
Top achievements
Rank 1
answered on 20 Jul 2016, 01:49 PM

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

0
Konstantin Dikov
Telerik team
answered on 22 Jul 2016, 02:45 PM
Hello 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
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Lavanya
Top achievements
Rank 1
commented on 13 Oct 2022, 06:54 AM

Very useful, The display property works amazingly and replacing Visible property. Thanks for the answer
0
Davide
Top achievements
Rank 1
answered on 22 Jul 2016, 04:46 PM

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

0
BALALAKSHMANAMOORTHY
Top achievements
Rank 1
answered on 05 Apr 2017, 07:42 PM

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

 

 

 

0
Eyup
Telerik team
answered on 07 Apr 2017, 05:37 AM
Hello 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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Davide
Top achievements
Rank 1
Answers by
Davide
Top achievements
Rank 1
Konstantin Dikov
Telerik team
BALALAKSHMANAMOORTHY
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or