row command in gridview not working?

Nov 24, 2008 at 5:13 AM
here is my html(in a usercontrol):
 <asp:Button ID="lnkEdit" runat="server" CommandArgument='<%# Eval("ID") %>'  CommandName='edt' Text="Edit" /></ItemTemplate>
here is code:
 protected void gvCategory_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) {
            if (e.CommandName == "edt") {

and the pageload:
  protected void Page_Load(object sender, EventArgs e) {
            if (!IsPostBack) {

after i clicked the button, the page_load method executed, but the row events never fired.


Nov 26, 2008 at 5:48 PM
I'm not sure what's going on. I noticed that to make things happen I needed to include DataKeyNames="ID". You can look at my test here. You didn't post a complete example so there might be some unobvious omission.
Nov 27, 2008 at 1:45 AM
thank you libardo.
yeah, it's fine in a normal aspx page.
the code itself is very simple, when I put it on a normal aspx page, it working fine.

but this is a template usercontrole:
  : Web.UI.TemplateUserControl<Items.AbstractPage, Items.EventCategoryMan>{