문제

In ASP.NET linkbutton -

<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? If so, how can I overwrite it and manually pass the CommandArgument to __EVENTARGUMENT? By default __EVENTARGUMENT seems to be empty.

Thanks

도움이 되었습니까?

해결책

The CommandArgument, as well as the CommandName are not sent from the client side to the server. They are Stored on the LinkButton's Viewstate and retrieved on the server side. In this case, the __EVENTARGUMENT Form Key will be empty.

You should be able to access the CommandArgument on the OnRowCommand event of the GridView

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top