gridview中每一行有一个button,根据某个状态设置其Text为不同的文字
想实现当Text为"审核"执行一种动作,Text为"删除"执行另一种动作
在if(e.CommandName="btnAction")
{
 
}中该如何写
望指教,谢谢

解决方案 »

  1.   

    Button b = e as Button;
    if(b.Text == "删除")
      

  2.   

    报错啊,Cannot convert type 'System.Web.UI.WebControls.GridViewCommandEventArgs' to 'System.Web.UI.WebControls.Button' via a built-in conversion C:\Documents and Settings\aaa\My Documents\Visual Studio 2005\Projects\manager\ManageSeller.aspx.cs 104 28 manager
      

  3.   

    你这个是在RowCommand事件里面写的吧,要在ButtonClick事件里写才行
    不然这样也可以的Button btn=(e as GridViewRow).FindControl("btnId") as Button;
    if(btn!=null){
           if(btn.text=""){}
    }你这样试一下