1、数据绑定事件
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if((e.Item.ItemType!=ListItemType.Header) &&
(e.Item.ItemType!=ListItemType.Footer))
{
LinkButton lbtn=(LinkButton)(e.Item.Cells[4].Controls[0]);
lbtn.Attributes["onclick"]="javascript:return confirm('你确定要删除此专业吗?');";
}
}
2、在列表命令
private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName != "ClsSelect")
{
Panel2.Visible = false;
return;
}
this.DataGrid2.EditItemIndex = -1;
}