using ItemCommand
来源:互联网 发布:yy网络主播赵哈哈 编辑:程序博客网 时间:2024/04/30 05:49
//first add following delegate in the private void InitializeComponent()
this.DataGrid1.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_ItemCommand);
public void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
switch(((LinkButton)e.CommandSource).CommandName)
{
case "Delete":
try
{
string str = e.Item.Cells[0].Text.Trim();//get the pk of the current row
string strSql1="select ....";
if(int.Parse(mySQL.ExecuteScalar(strSql1).ToString())>=1)
{
Response.Write("<script language=javascript>alert('exist somebody in this department!');</script>");
return;
}
else
{
string strSql = "delete...'";
mySQL.ExecuteNonQuery(strSql);
this.DataGrid1.CurrentPageIndex=0;
this.Bind_Dg();
}
}
catch
{return;}
Response.Write("<script language=javascript>alert('Already delete it!');</script>");
break;
// Add other cases here, if there are multiple ButtonColumns in
// the DataGrid control.
case "Edit":
try
{
this.DataGrid1.EditItemIndex=e.Item.ItemIndex;
this.Bind_Dg();
}
catch
{}
break;
default:
// Do nothing.
break;
}
}
- using ItemCommand
- ItemCommand事件
- DataGrid的ItemCommand响应
- ItemCreated && ItemDataBound && ItemCommand
- ItemCommand事件不响应
- ItemCommand事件不响应
- DataList.ItemCommand 事件
- ItemCommand不响应的问题
- Repeater 控件的 ItemCommand 事件
- ListView里的ItemCommand--笔记
- Repeater的ItemCommand使用的问题
- Repeater为啥无法触发ItemCommand事件
- repeat 的两个事件ItemDataBound和ItemCommand
- telerik RadTreeList、RadGrid的itemCommand用法区别
- Repeater嵌套内层Repeater绑定ItemCommand事件
- Repeater02-Repeater按钮的ItemCommand事件
- using()
- using
- AT 指令
- 解读NTFS(一)
- 在win2000、winXP下看 **********
- 一位学长的成长经历——[转]我的东软五年
- Make your owner PE Protector Part 1: Your first EXE Protector
- using ItemCommand
- ISAPI筛选器及对ASP源文件的保护
- 安装SATA硬盘
- ActiveForm 带参数用法
- delphi多线程程序示例(与.net一样简单)
- 金蝶与Sun签署战略合作协议:共拓Java市场
- use stack to initial a treeview with the data in a database
- 继李开复之后 Google挖角UT斯达康CEO周韶宁
- 今天有点困,脑袋不是很清醒!