当前位置: 代码迷 >> ASP.NET >> 急小弟我在datagrid中添加了一个button控件。
  详细解决方案

急小弟我在datagrid中添加了一个button控件。

热度:2999   发布时间:2013-02-26 00:00:00.0
急急!!!我在datagrid中添加了一个button控件。。。
我在datagrid中添加了一个button控件,我给button的控件的commandname的属性设置为btn,然后我调用datagirde的ItemCommand事件。代码如下:
private   void   DataGrid1_ItemCommand(object   source,   System.Web.UI.WebControls.DataGridCommandEventArgs   e)
{

if(e.CommandName   ==   "Btn ")
{
Response.Write( " <script> window.getElementById( 'a ').style.visibility= 'visible ' </script> ");

}
}
在前台,我把这个div设置为不可见,但是,当我点击button以后,没有反映,我跟踪后发现根本没有运行DataGrid1_ItemCommand这个事件,这是怎么回事!!

------解决方案--------------------------------------------------------
在Page_Load事件中对数据绑定做是否是回传页的判断
  相关解决方案