Dynamic label
how to create label , textbox and button dynamically on button cilck event using C# code behind for web application
2 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
Arul Manivannan48 reputationPosted Mar 21, 2013, 5:07 AM EDT
Label lbl = new Label();
lbl.Text = "Tamil Eelam is the destiny";
Page.Controls.Add(lbl);
Button btn = new Button();
btn.Text = "New";
Page.Controls.Add(btn);
TextBox txt = new TextBox();
Page.Controls.Add(txt);
Hope this helps. Arul Manivannan
Pradip PandeyRank #452 · 5.6K reputationPosted Mar 21, 2013, 8:50 PM EDT
Write the following syntax on button click event
Button button = new Button();
Page.Controls.Add(button);
Page.Controls.Add(label);
Page.Controls.Add(textbox);
Hope it will help you.