[英]Pass ASP:LinkButton CommandArgument to __doPostBack __EVENTARGUMENT
In ASP.NET linkbutton - 在ASP.NET链接按钮 -
<asp:TemplateField HeaderText="Delete" SortExpression="" Visible="True">
<ItemTemplate>
<asp:LinkButton ID="btnDelete" CommandName="Delete" runat="server" CommandArgument='<%# Eval("ID") %>' Text="Delete"/>
</ItemTemplate>
</asp:TemplateField>
Will __doPostBack function always be generated? 始终会生成__doPostBack函数吗? If so, how can I overwrite it and manually pass the CommandArgument to __EVENTARGUMENT?
如果是这样,我如何覆盖它并手动将CommandArgument传递给__EVENTARGUMENT? By default __EVENTARGUMENT seems to be empty.
默认情况下__EVENTARGUMENT似乎是空的。
Thanks 谢谢
The CommandArgument
, as well as the CommandName
are not sent from the client side to the server. CommandArgument
以及CommandName
不会从客户端发送到服务器。 They are Stored on the LinkButton's Viewstate and retrieved on the server side. 它们存储在LinkButton的Viewstate中,并在服务器端检索。 In this case, the
__EVENTARGUMENT
Form Key will be empty. 在这种情况下,
__EVENTARGUMENT
表单键将为空。
You should be able to access the CommandArgument on the OnRowCommand
event of the GridView
您应该能够访问
GridView
的OnRowCommand
事件上的CommandArgument
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.