I am trying to retreive the value of a cell from a selected row in a webdata grid when I click a command button
Here is the code I have in the command button
SelComment = GridView.Behaviors.Selection.SelectedRows(0).DataItem (0).ToString
End Sub
When I click on the button, I always get this error:
System.NullReferenceException Why am I getting null values from the grid, when I have a selected row? I am not able to get any of the cell values from the selected row. A related problem is when the button does the post back, all the rows on the grid disppears. Not sure why. I am using Visual Studio 2010 and the version of NetAdvantage I have is Version=11.2.20112.1019 Please help. Thanks
System.NullReferenceException
Why am I getting null values from the grid, when I have a selected row?
I am not able to get any of the cell values from the selected row.
A related problem is when the button does the post back, all the rows on the grid disppears. Not sure why.
I am using Visual Studio 2010 and the version of NetAdvantage I have is Version=11.2.20112.1019
Version=11.2.20112.1019
Please help.
Thanks
Hello ngrs01,
I have created a sample to demonstrate how you can achieve this. Instead of going through the DataItem you will want to go through the Items to get a cell value. Also I believe this and the other issue you are experiencing of the grid disappears is a result of you not setting the data back to the grid on postback. The sample I have attached demonstrates this.
Please let me know if you have any questions concerning this matter.
Sincerely,Mike P.Developer Support EngineerInfragistics, Inc.www.infragistics.com
Thanks Mike, I got the grid working the way you suggested. I am able to get to the cell value as I could with the UltraGrid. Thanks again.