I have SqlDataSource assigned to a GridView, and a lot of the fields returned are only used in the code behind to determine whether a column is visible, etc. Currently I bind these vlaues to a hiddenfield, however this adds a lot of code to the source file which isn’t ideal.
Can I get the values for the row from the codebehind, without having to assign them to a hiddenfield in the markup?
In your code behind, you can access the values through the
DataItemobjectExample
Or you could convert the value to an object and play around with it.
Take a look here for more info http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewrow.dataitem.aspx