asp.net cs中定义的控件如何在前台显示
展开全部
可以定义客户端控件:Response.Write("<input type=’button‘ value=’button‘ />")
服务端控件:
Button btn=new Button();
btn.ID=“Button1”;
btn.Text=“提交”;
TextBox tb = new TextBox();
tb.ID = "txt" + (Panel1.Controls.Count + 1).ToString();
tb.Text = tb.ID;
tb.Controls.Add(new LiteralControl("test"));
Button bt = new Button();
bt.ID = "btn" + (Panel1.Controls.Count + 1).ToString();
bt.Text = bt.ID;
bt.Click += new System.EventHandler(Button1_Click);
Panel1.Controls.Add(tb);
Panel1.Controls.Add(bt);
服务端控件:
Button btn=new Button();
btn.ID=“Button1”;
btn.Text=“提交”;
TextBox tb = new TextBox();
tb.ID = "txt" + (Panel1.Controls.Count + 1).ToString();
tb.Text = tb.ID;
tb.Controls.Add(new LiteralControl("test"));
Button bt = new Button();
bt.ID = "btn" + (Panel1.Controls.Count + 1).ToString();
bt.Text = bt.ID;
bt.Click += new System.EventHandler(Button1_Click);
Panel1.Controls.Add(tb);
Panel1.Controls.Add(bt);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询