datagrid的问题 我在datagrid中绑定了一列按扭,请问应该在哪里设定这组按钮的事件呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考:private void DataGrid_ItemCommand(object source, DataGridCommandEventArgs e) { if(e.CommandSource is Button){ 此外写上相应的处理的代码. }} private void DataGrid_ItemCommand(object source, DataGridCommandEventArgs e) {if(e.CommandSource is Button){ switch(((Button)e.CommandSource).ID){ case "Delete": 此外写上相应的处理的代码; break; case "Insert": 此外写上相应的处理的代码; break; default: break; }}} 再页面中,设置button commandname 属性,private void DataGrid_ItemCommand(object source, DataGridCommandEventArgs e) {if(e.commandname==""){}} 可以在页面代码上,某个按钮里写 OnClick="方法名",然后在代码里写Protected void 方法名(EventArgs e) 呵呵,首先问一下楼主,试下CancelCommand事件,和UpdateCommand事件,也可以ItemDataCommand,不过得知道搂住的按钮是在模板列的还是按钮列? 什么样的标题才引人注意?求助啊!! 绕过验证码登陆,模拟读取cookie发送至网站登陆的问题 有图有真相,C#编写远程关闭电脑所遇到的问题 一个泛型方法的定义 c#动态改IP地址 使用 WM_COPYDATA 的疑问 关于创建XML的问题(急!!) 如何在.NET中运行IE控件里HTML页面的脚本函数? 在w98下的打印问题(在线等待) 初学c#,有个简单的问题搞不定,各位帮帮忙! 为何添加新纪录是长文本字段不能够写入ACCESS数据库 怎样在程序中激活treeview的afterselect事件方法?
private void DataGrid_ItemCommand(object source, DataGridCommandEventArgs e) {
if(e.CommandSource is Button){
此外写上相应的处理的代码.
}
}
private void DataGrid_ItemCommand(object source, DataGridCommandEventArgs e) {
if(e.CommandSource is Button){
switch(((Button)e.CommandSource).ID){
case "Delete":
此外写上相应的处理的代码;
break;
case "Insert":
此外写上相应的处理的代码;
break;
default:
break;
}
}
}
{
if(e.commandname=="")
{}
}