日期:2014-05-20  浏览次数:20377 次

偶的三个问题,顶者有分~
1.想把几个Button比如Button1,Button2...ButtonA,ButtonB都绑定Button_Click

protected   void   Button_Click(object   sender,   EventArgs   e)
{
      Button.Text= "调用者 ";                
}

也就是说调用者自己修改自己的文本而已,怎么让通用呀???
这是最重要的问题~

2.ASP.NET   AJAX在一般的.NET   2.0虚拟主机上可以虚拟目录就运行吗?
也就是不安装,只引用?

3.一般的虚拟主机支持SqlServer   2005   Express吗?
感觉支持蛮好的~

------解决方案--------------------
this.Buttonxx.Click += new System.EventHandler(this.Button_Click);
就可以了。
Buttonxx 就是Button1,Button2...ButtonA,ButtonB等
------解决方案--------------------
object sender

((Button)sender).Text= "调用者 ";
------解决方案--------------------
帮你顶了
------解决方案--------------------
帮你顶了
------解决方案--------------------
1.用委托
2.需要在你项目中引用
3.现在支持sql2005的少
------解决方案--------------------
up
------解决方案--------------------
private void btnKind_Click(object sender, EventArgs e)
{
string strbtnName = ((Button)sender).Name.ToString();
switch (strbtnName)
{
case "btnKind1 ": axMSChart.chartType = MSChart20Lib.VtChChartType.VtChChartType3dLine; break;
case "btnKind2 ": axMSChart.chartType = MSChart20Lib.VtChChartType.VtChChartType2dLine; break;
case "btnKind3 ": axMSChart.chartType = MSChart20Lib.VtChChartType.VtChChartType3dBar; break;
case "btnKind4 ": axMSChart.chartType = MSChart20Lib.VtChChartType.VtChChartType2dBar; break;
case "btnKind5 ": axMSChart.chartType = MSChart20Lib.VtChChartType.VtChChartType2dPie; break;
case "btnKind6 ": axMSChart.chartType = MSChart20Lib.VtChChartType.VtChChartType2dStep; break;
case "btnKind7 ": axMSChart.chartType = MSChart20Lib.VtChChartType.VtChChartType3dStep; break;
}
}

------解决方案--------------------
protected sub Button_Click(object sender, EventArgs e) handles Button1.Click,Button2.Click,Button3.Click
select case button.id
case " "
...
case " "
...
case " "
...
end select
end sub
------解决方案--------------------
((Button)Sender).Text=((Button)Sender).ID.ToString();