Asp.net
how to create panel dynamically?????
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dipankar BiswasRank #992 · 2K reputationPosted Apr 4, 2015, 7:53 AM EDT
Panel pnl = new Panel();
TextBox txt=new TextBox();
pnl.Controls.Add(txt);
Form.Controls.Add(pnl);
Thanks
Abhay ShankerRank #375 · 6.7K reputationPosted Apr 4, 2015, 4:42 PM EDT
Panel pnl = new Panel();
this.form1.Controls.Add(pnl);
Label lbl= new Label(); //Controls to add in panel
lbl.Text="Test";
pnl.Width = 200;
pnl.Height = 200;
pnl.BackColor = System.Drawing.Color.Red;
pnl.BorderColor = System.Drawing.Color.Black;
pnl.Controls.Add(lbl);
pnl.Visible = true;
pnl.Enabled = true;
Khargesh RajputRank #616 · 3.9K reputationPosted Apr 4, 2015, 7:40 PM EDT
But to Add a placeholder in aspx where you want to show panel
And in cs page
Panel pnl = new Panel();
TextBox txt=new TextBox();
pnl.Controls.Add(txt);
Plchold.Controls.Add(pnl);
Gowtham RajamanickamRank #57 · 29K reputationPosted Apr 4, 2015, 9:26 PM EDT