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各按钮导出他们自己的资料... 我想应该是要做个判断吧?
{
this.ButExcel("application/ms-excel","加班時間大於36小時.xls");
this.ButExcel2("application/ms-excel","加班時間大於120小時.xls");
}
A按钮"36小时的"
B按钮"120小时的" 用Command事件怎样才能实现-点击A、B各按钮导出他们自己的资料... 我想应该是要做个判断吧?
Button btn = sender as Button;
判断if(btn.什么==什么) //36
{
//执行36
}
else if
fsefseljf32%@%@……@¥@等等
{
Button btn = (Button)sender
if(btn == button1)
this.ButExcel("application/ms-excel","加班時間大於36小時.xls");
else
this.ButExcel2("application/ms-excel","加班時間大於120小時.xls");
}
{
Button btn = (Button)sender;
if(btn == button1)
this.ButExcel("application/ms-excel","加班時間大於36小時.xls");
else
this.ButExcel2("application/ms-excel","加班時間大於120小時.xls");
}
=============
1。
谁告诉你这是个事件?2。
标准用法
// .aspx
<asp:button id=btnA commandname="CmdA" oncommand=ReBut5_Command
<asp:button id=btnB commandname="CmdB" oncommand=ReBut5_Command// .aspx.csprivate 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