lost commandargument

if you're using gridview and the MS integrated command (select, edit, delete), when you change it to template, u will lose the commanceargument (the row index that you're clicking on). LO and behold! another bug frm M$.

here's the workaround:

in the row created event , add this:

If e.Row.RowType = DataControlRowType.DataRow Then

' Retrieve the LinkButton control from the first column.
Dim addButton As LinkButton = directcast(e.row.findcontrol(""),linkbutton)

' Set the LinkButton's CommandArgument property with the
' row's index.
addButton.CommandArgument = e.Row.RowIndex.ToString()

End If

No comments:

Powered by Blogger.