0

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

Don
  • 1,532
  • 4
  • 24
  • 47

1 Answers1

3

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

Mateus Schneiders
  • 4,853
  • 3
  • 20
  • 40
  • you answered this question. Thanks. The problem is that my control can not generate OnRowCommand event. I don't know why. This question is a sub question of "http://stackoverflow.com/questions/20779650/classic-asp-net-delete-event-is-not-invoked-in-dynamically-generated-datagrid-co". Could you please take a look at that one too? – Don Dec 26 '13 at 22:39