recent posts

banner image

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
lost commandargument lost commandargument Reviewed by Surebor on July 29, 2007 Rating: 5

No comments:

Powered by Blogger.