日期:2014-05-19  浏览次数:20430 次

急急!!!我在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事件中对数据绑定做是否是回传页的判断