双击“属性”窗口中的“EditCommand”,并添加如下代码:
DataGrid1.EditItemIndex = e.Item.ItemIndex;
DataGrid1.DataBind();
在 CancelCommand 事件处理程序中添加下面的代码:
DataGrid1.EditItemIndex = -1;
DataGrid1.DataBind(); 为什么DataGrid的“编辑”,“取消”这些按钮都要点两下(中间还要有微微的停顿)事件才会发生呢?? 谢谢
DataGrid1.EditItemIndex = e.Item.ItemIndex;
DataGrid1.DataBind();
在 CancelCommand 事件处理程序中添加下面的代码:
DataGrid1.EditItemIndex = -1;
DataGrid1.DataBind(); 为什么DataGrid的“编辑”,“取消”这些按钮都要点两下(中间还要有微微的停顿)事件才会发生呢?? 谢谢
解决方案 »
- 把SQL语句存放在XML
- C#如何从comobBox控件中选择信息和再填入数据表中
- win 2003 asp.net 无法登录后台
- 谁能写这样一个简单的例子??
- 求助:类似淘宝的商品选择条件累加实现
- 为何导致其他的input type="file"不能正常使用?
- petshop结构中,如果我想根据不同的逻辑,采用不同的数据库,可以吗?
- ASP中的一个小问题!!!大家指点一下!!!20分
- 我申请了一个域名www.flash2004.com,如何配合“花生壳”服务将我的动态IP的计算机绑定......请你喝喜酒!
- 请问如何用log4net记日志到数据库?
- 请问如何将一个Label控件与一个TextBox控件绑定在一起?
- 关于前台页面的INPUT标签的值怎么实时传到后台
PageLoad 里面对DataGrid1的绑定不在 if(!Page.IsPostBack){ ... } 里面?
可能是这造成的 !
如果你的DataGrid是放在用户控件里面,很可能发生这种情况
setbind()
End IfSub setbind()
Dim strConn As String = ConfigurationSettings.AppSettings("dsn")
Dim mycon As New SqlClient.SqlConnection(strConn)
Dim Adapter As New SqlClient.SqlDataAdapter("select * from sys_user", mycon)
Dim ds As New DataSet
Adapter.Fill(ds, "sys_user")
DataGrid1.DataSource = ds.Tables("sys_user")
DataGrid1.DataBind()
End Sub
补充:
如果你的DataGrid是放在用户控件里面,很可能发生这种情况
==========
我一直都放用户控件里,没出现这种情况看看为什么两次重载了