Products
Database Search Solution (New Version) Search Control SEO Pager Highlighter Shortcut Controls Crypt Package Free ASP.NET Controls
Geotargeting Component ASP.NET Media Player Control Flash Video Player Control Services
ASP.NET Telecommute Jobs Free IP Location Lookup Test .Net Regular Expressions CSS/Table/DIV Page Layouts Custom Programming Article Sites Master List |
About GridView Hidden ColumnWhen a Gridview column's visibility is set to False, then the Grid does not bind data to the column, and thus when you try to retrieve data from the hidden column in the code-behind, it either blows up or returns an empty string. Maybe you don't need itIt's likely that you don't need the column, at all. If it's not used in your Update statement, Insert statement, or in the code behind, then just remove it. If you are using Table Adapters, then remove the column out of the TableAdapter. Need it in the Code BehindIf you really need it, don't hide the column, remove it as a column, and then add the column name to the DataKeyNames Collection of the Gridview. You can now access these columns in the special DataKey collection of the Gridview, i.e. Gridview1.Datakeys(iRow).Values You need to pass this back to SQLIf you actually need to pass this back to SQL (via table adapters) then you have to configure the table adapters to accept the column. All columns in the DataKeyNames get the "Original_" prefix as defined in the ods property OldValuesParameterFormatString="original_{0}" Modify the Update Parameter Collection Such that the hidden column expects the prefix (just like your Primary Key column was done automatically) Lastly edit the actual T-SQL to expect the parameter with the prefix. This tutorial is written by Jeremy Libertor Tutorial toolbar: Tell A Friend | Add to favorites | Feedback | |