private void ReBut5_Command(object sender, WebControls.CommandEventArgs e)
{
this.ButExcel( "application/ms-excel ", "加班時間大於36小時.xls ");
this.ButExcel2( "application/ms-excel ", "加班時間大於120小時.xls ");
}
A按钮 "36小时的 "
B按钮 "120小时的 " 用Command事件怎样才能实现-点击A、B各按钮导出他们自己的资料...
我想应该是要做个判断吧?
------解决方案--------------------------------------------------------
帮你顶起来!
------解决方案--------------------------------------------------------
a b 总有他们不同的地方 id commandv#!%!#。。 什么的
Button btn = sender as Button;
判断if(btn.什么==什么) //36
{
//执行36
}
else if
fsefseljf32%@%@……@¥@等等
------解决方案--------------------------------------------------------
private void ReBut5_Command(object sender, WebControls.CommandEventArgs e)
{
Button btn = (Button)sender
if(btn == button1)
this.ButExcel( "application/ms-excel ", "加班時間大於36小時.xls ");
else
this.ButExcel2( "application/ms-excel ", "加班時間大於120小時.xls ");
}
------解决方案--------------------------------------------------------
private void ReBut5_Command(object sender, WebControls.CommandEventArgs e)
{
Button btn = (Button)sender;
if(btn == button1)
this.ButExcel( "application/ms-excel ", "加班時間大於36小時.xls ");
else
this.ButExcel2( "application/ms-excel ", "加班時間大於120小時.xls ");
}
------解决方案--------------------------------------------------------
也可以根据按钮的 CommandName进行区分
------解决方案--------------------------------------------------------
哪里来的 CommandName? 没有这个事件?
=============
1。
谁告诉你这是个事件?
2。
标准用法
// .aspx
<asp:button id=btnA commandname= "CmdA " oncommand=ReBut5_Command
<asp:button id=btnB commandname= "CmdB " oncommand=ReBut5_Command
// .aspx.cs
private void ReBut5_Command(object sender, WebControls.CommandEventArgs e)
{
switch(e.CommandName)
case "CmdA " :
this.ButExcel( "application/ms-excel ", "加班時間大於36小時.xls ");
break;
case "CmdA " :
this.ButExcel2( "application/ms-excel ", "加班時間大於120小時.xls ");
break;
}
3。
其他用法如 高歌 所示
4。
详细 DEMO
http://msdn2.microsoft.com/zh-cn/library/system.web.ui.webcontrols.commandeventargs(VS.80).aspx