datagrid中的按鈕列問題 我在datagrid中添加了兩列按鈕列,可是我現在不能判定我究竟按下的是該行的那個按鈕?注:這兩列應為其他原因所以用的不是edit列,而是itemtemplate中添加的button。那位高手能屆決,絕對感激!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 给你的Button的CommandName分别指定值在Item_Command事件里面判断if(e.CommandName = "xxx").......... 给两个按钮的 CommandName 属性指定两个值,如:cmdEdit 和 cmdDel然后在 Item_Command 事件里判断:如下:private void Item_Command(....){ if(e.CommandName == "cmdEdit") { //your edit code here } else if(e.CommandName == "cmdDel") { //your delete code here }} asp:Button ID=bu1 Runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"view")%>' CommandName="view"></asp:Button>asp:Button ID=bu2 Runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"down")%>' CommandName="down"></asp:Button>在ItemCommand事件中if(e.CommandName=="view"){//第一个按钮}else//第二个按钮 winform调用存储过程错误 DropDownList的绑定问题 关于网站项目的设计 C#怎么动态删除DIV层的,我的方法为什么不行呢? [讨论] 如何让网页第一次加载就ajax? 怎样使用户在textBox里输入4个字符,自动跳转到下一个textBox? 要通过一个IFRAME 调用一个动态页,怎么样给这个动态页一个参数(它需要ID号读数据库) 如何设定 访问某个文件夹前必须访问某个页面 asp.net与wpf的代码隐藏(codebehind)设计思想是一样的吗? 请问如何打印Dundas控件生成的图片呢? 急~!一个页面两个用户控件读取会话的问题2. IIS的配置??
在Item_Command事件里面判断
if(e.CommandName = "xxx")
..........
然后在 Item_Command 事件里判断:如下:private void Item_Command(....)
{
if(e.CommandName == "cmdEdit")
{
//your edit code here
}
else if(e.CommandName == "cmdDel")
{
//your delete code here
}
}
</asp:Button>
asp:Button ID=bu2 Runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"down")%>' CommandName="down">
</asp:Button>在ItemCommand事件中
if(e.CommandName=="view")
{
//第一个按钮
}
else
//第二个按钮