Dynamic Control
-
I have a problem to add a dynamic control to my page i add the fllow code to Page_load() Whats the problem ?? Button img = new Button(); img.Width = 15; img.Height = 15; HtmlForm form1 = this.FindControl("Form1") as HtmlForm; form1.Controls.Add(img); No thing add to the page ??? With Thanks MHF
-
I have a problem to add a dynamic control to my page i add the fllow code to Page_load() Whats the problem ?? Button img = new Button(); img.Width = 15; img.Height = 15; HtmlForm form1 = this.FindControl("Form1") as HtmlForm; form1.Controls.Add(img); No thing add to the page ??? With Thanks MHF
Hi, I think you must use PlaceHolder control how container. For example:
protected void Page_Load(object sender, EventArgs e) { Button img = new Button(); img.Width = 15; img.Height = 15; img.Click += new EventHandler(img_Click); mPlaceHolder.Controls.Add(img); }