日期:2014-05-18  浏览次数:20387 次

动态产生的Button、ImageButton如何与服务器的过程关联
Dim   btn   As   New   Button
查看btn,发现其没有OnClick属性,只有OnClientClick属性,那么点击它之后,如何执行服务器的过程呢?

------解决方案--------------------
protected void Page_Load(object sender, EventArgs e)
{
int n = 10;
double E = Math.E;
double x = 2;
double p1 = Math.Pow(E, x);
double p2 = 1;
for (int i = 1; i <= n; i++)
{
p2 += Math.Pow(x,i) / factorial(i);
}
Label1.Text = p1.ToString() + " " + p2.ToString();

string str = Request.MapPath( "mhub_pdf ");

Button Button1 = new Button();
Button1.Click += new EventHandler(Button1_Click);
Button1.Text = "button ";
td1.Controls.Add(Button1);
}

protected void Button1_Click(object sender, EventArgs e)
{

}

C#语法的,翻译过来吧
------解决方案--------------------
addhandle bt.click addressof bt_click