I'm having user inadvertantely click the header row and it throws and error. How can I detect a header row click and prevent anything from happening?
I'm looking for something like this...
If UltraWebGrid1.DisplayLayout.ActiveRow = HeaderRow Then label1.Text = "Header Click" Else label1.Text = e.Row.Cells(2).Value.ToString End If
I am using the server-side Click event. I do a check for the following which seems to be weeding out the header clicks. I would prefer to do a client-side check to prevent the postback but I'm not good with scripting unless I have a good example.
If Not e.Row Is Nothing Then
'Header row not clicked
End If
Determining the best solution to this depends on what event you're currently handling, and what result you're trying to get.
It sounds like you're using the grid's server-side Click event. The grid's headers cannot become an "active row," so the for-example code you provided wouldn't work. You might be able to intercept the client-side Click event (which provides a way to determine what was clicked) and cancel the postback if a column header was clicked.