Invisible column loses value

6 posts, 0 answers
  1. Davide
    Davide avatar
    7 posts
    Member since:
    Nov 2007

    Posted 20 Jul 2016 Link to this post

    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

  2. Davide
    Davide avatar
    7 posts
    Member since:
    Nov 2007

    Posted 20 Jul 2016 in reply to Davide Link to this post

    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

  3. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2011 posts

    Posted 22 Jul 2016 Link to this post

    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.
  4. Davide
    Davide avatar
    7 posts
    Member since:
    Nov 2007

    Posted 22 Jul 2016 in reply to Konstantin Dikov Link to this post

    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

  5. BALALAKSHMANAMOORTHY
    BALALAKSHMANAMOORTHY avatar
    1 posts
    Member since:
    Jul 2012

    Posted 05 Apr Link to this post

    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

     

     

     

  6. Eyup
    Admin
    Eyup avatar
    3175 posts

    Posted 07 Apr Link to this post

    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.
Back to Top