I'm trying to modify the output of my GridView in the RowDataBound event handler, but it's not working - nothing happens.
My code:
Private Sub MyGridView_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles MyGridView.RowDataBound
e.Row.Attributes.Add("data-xkoordinat", 0)
End Sub
What I expect to see:
<tr data-xkoordinat="0">..</tr>
What comes out
<tr>...</tr>
How do I add the attribute?
Update:
I've researched some more, and noticed that there is nothing in the trace about the RowDataBound
method - should there be? My Page_Load
routine, where the databinding happens, is as follows:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Using db As IDatabaseAdapter = Locator.GetDatabaseAdapter()
db.Open()
MyGridView.DataSource = db.ExecuteReader("MatpunktLista", True, {db.CreateParameter("id_uppdrag", Request.QueryString("id_uppdrag"))})
MyGridView.DataBind()
End Using
End Sub
Is there anything here that would cause the rows not to be databound? I'm reloading via F5 or by selecting the address field in my browser and hitting Enter, so I don't think postbacks should be an issue.