COMMUNITY: How to properly ask a question on Forums
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
vignesh t
1.6k
31
546
Create controls dynamically on button click
Jan 8 2018 1:01 AM
Hi,
I need to create dynamic controls on button click.
HTML:
CODE:
When clicked on AddSorting shown in the below image I am trying to create dropdown control using below code and the controls doesn't show.
protected void lnkAddSort_Click(object sender, EventArgs e)
{
int index = pnlSort.Controls.OfType
().ToList().Count + 1;
this.Createddl("ddldyn" + index);
}
public void Createddl(string id)
{
DropDownList ddl = new DropDownList();
ddl.ID = id;
pnlSort.Controls.Add(ddl);
Literal lt = new Literal();
lt.Text = "
";
pnlSort.Controls.Add(lt);
}
Can anyone please provide suggestions on how to handle this?
Reply
Answers (
1
)
Download files having special characters in filemame
value not update in Registry at given path in C#
"