2012-02-28 80 views
0

我有一个ASP .NET项目下面的代码它有一个GridView用下面的代码:ASP.NET的按钮栏命令

  <Columns> 
      <asp:ButtonField ButtonType="Button" CommandName="Sel" Text="Select" /> 
     </Columns> 

,我试图单击时引发一个事件。我使用下面的代码在cs文件:

 protected void grdTimes_RowCommand(Object sender, GridViewCommandEventArgs e) 
    { 
     if (e.CommandName == "Sel") 
     { 
      lblError.Text = "command"; 
     } 
    } 

不幸的是,lblerror.text犯规变化是单击按钮时。有任何想法吗?

回答

0

那么,在我的情况下它正常工作(我也使用Response.Write)。我会告诉你用Response.Write尝试,如果它有效,可能是你的标签设置有误。

如果你想用你的整个标记编辑你的问题,请随时做!