You haven't shown us *where* the above code is located... in which event handler ?
There could be one main reason why the SelectedRow property would return Null: The SelectedIndex of the GridView is -1 (No row is marked as selected). This condition could result if the LinkButton which causes the GridView to go into Edit mode isn't configured properly. On Aug 4, 10:37 pm, Ana Drumond <[email protected]> wrote: > Hi, > > I'm new to ASP.NET and I'm having the following problem: I have a GridView > where the user can update any row he wants by clicking on a LinkButton > (Edit). The code for getting the selectedRow is like this: > > Dim selectedRow As GridViewRow = MyGridView.SelectedRow > Dim myTextBox As TextBox = selectedRow.FindControl("myTextBox ") > Dim info As String = myTextBox.Text > > However, my selectedRow is always Nothing. Does anyone knows how can I get > the selectedRow in a different way? Any help would be greatly appreciated! > > Thanks, > Ana
