I've done this with a asp.net Gridview. but does anybody have any examples on how to pass row information from an asp.net button in SharePoint Dataview开发者_如何学C rows to an inline C# function?
the button Repeats as follows:
<asp:Button runat="server" Text="Delete" id="Delete{@ID}" OnClick="DeleteDoc()"/>
My function looks like this:
void DeleteDoc(object sender, EventArgs e) { }
}
I tried adding another parameter but get:
No overload for 'DeleteDoc' matches delegate 'System.EventHandler'
Try to change your method access modifier to protected and OnClick="DeleteDoc()" to OnClick="DeleteDoc".
Also i didn't managed to make it work with id="Delete{@ID}" so try without that to.
This worked on my test case
<asp:Button runat="server" Text="Delete"
OnClick="DeleteDoc"
CommandArgument='<%# Eval("ID")%>'/>
and
protected void DeleteDoc(object sender, EventArgs e)
{
Button b = sender as Button;
YourDeleteDocumentHelperMethod(b.CommandArgument);
}
精彩评论