This is a migrated thread and some comments may be shown as answers.

Add Items on server side

2 Answers 557 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 09 Dec 2013, 10:15 PM
Hello,

Can anyone help me how to add items to RadDropDownList control from server side?

I tried, but it is not working
RadDropDownList1.Items.Add(ID + 1);

Thanks,
Sam

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 10 Dec 2013, 03:31 AM
Hi Sam,

Please have a look into the following C# code to add RadDropDownList Item from server side.

C#:
protected void Page_Load(object sender, EventArgs e)
{
    DropDownListItem item = new DropDownListItem();
    item.Text = "Item1";
    RadDropDownList1.Items.Add(item);
    DropDownListItem item1 = new DropDownListItem();
    item1.Text = "Item2";
    RadDropDownList1.Items.Add(item1);
}

Let me know if you have any concern.
Thanks,
Princy.
0
Sam
Top achievements
Rank 1
answered on 10 Dec 2013, 01:09 PM
It works.  It is binding a little differently with ASP.NET DropDownList control

Thank you!!
Tags
DropDownList
Asked by
Sam
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Sam
Top achievements
Rank 1
Share this question
or