Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
WebDataGrid Cell Value
posted

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

 

 

 

 

 

 

 

 

 

 

 

Protected Sub Button_Edit_Click(sender As Object, e As EventArgs) Handles Button_Edit.Click

 

 

 

Dim SelComment As String

 

 

 

Dim cIndex As Integer

 

 

 

Dim selectedRow As Integer

 

 

 

If GridView.Behaviors.Selection.SelectedRows.Count > 0 Then

 

 

 

    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