Error:System.NullReferenceException: Object reference not set to an instance of an object.
Hi! I get an error on this block:
protectedvoid gvSearch_SelectedIndexChanged(object sender,EventArgs e){
try
{
// This will contain the selectedValue of the row
string selectedCategory = gvSearch.SelectedRow.Cells[1].Text;
}
catch (Exception err){
lblError.Text = err.ToString();
}
}
I got the numbers showing at the bottom of the gridview, but when I click on a number i get this error. Thanks for the help!
To access SelectedRow in GridView you need to set enableSelection Property to True.
0 comments:
Post a Comment