想抓狂。。。。。。。。
CheckBox chk = null;
BLL.RegUsers BReg = new BLL.RegUsers();
BLL.Business BBusiness = new BLL.Business();
BLL.Products BProducts = new BLL.Products();
BLL.NewsInfo BNewsInfo = new BLL.NewsInfo();
BLL.CreditInfo BCreditInfo = new BLL.CreditInfo();
BLL.ReferInfo BReferInfo = new BLL.ReferInfo();
int val = 0;
foreach(DataListItem myitem in this.Datalist1.Items)
{
chk = (CheckBox)myitem.FindControl( "myCheck ");
if(chk.Checked)
{
String username = this.Datalist1.DataKeys[myitem.ItemIndex].ToString();
val = BReg.DeleteUser(username); //删除用户
BBusiness.DeleteUserBusiness(username);//删除用户所有商机
BProducts.DeleteUserProduct(username);//删除用户所有产品
BNewsInfo.DeleteUserNews(username);//删除用户所有新闻
BCreditInfo.DeleteUserCreditInfo(username);//删除用户公司管理证书
BReferInfo.DeleteUserRefer(username,username);//删除用户发出所有询盘和接收询盘
BCreditInfo.DeleteUserCreditInfo(username);
}
}
if (val > 0 )
Response.Write( " <script> alert( '提示:删除成功! ');self.location.href= 'ManageVipUsers.aspx '; </script> ");
else
Response.Write( " <script> alert( '提示:删除失败! ');self.location.href= 'ManageVipUsers.aspx '; </script> ");
明明选中了CHECKBOX就是不执行chk.Checked里面这段。
------解决方案--------------------我以前用DataGrid做过同样的效果,明明选中了但就是不执行,后来重新建了一个新的页面把所有的代码拷贝到新的页面再执行就可以了.不晓得你这样试试看可以不.因为.NET的缺陷就是很容易把执行的事件丢失