In my application i am using a GridView and i am adding an onlick attribute to the GridView through the following Code..
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes("onclick") = Page.ClientScript.GetPostBackClientHyperlink(GridView1, "Select$" & e.Row.RowIndex.ToString())
End If
When someone selects a row in the Grid view, i want the GridView to get disabled and not allow any other selections unless the user presses a button. I tried using
GridView1.Enabled = false
But still the user is able to select a row.
How can i disable the GridView Selection ??
Since you are selecting a row by the above code the easiest fix would be to check if selected index is not equal to -1 (meaning a row has been selected) in the row databound event.
and to reattach the selecting code on the click of a button you can just set the selectedIndex to -1 and rebind the gridview in the button click event.