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

[Solved] Add Item bevor SQLDataSource

1 Answer 69 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kanal8
Top achievements
Rank 1
Kanal8 asked on 01 Jul 2008, 03:37 PM
Hello!

My RadComboBox is filled by a SQLDataSource. After that I want to Insert a special item ("create new"). This works fine, but I need the Item at the first position in my ComboBox. How can i do this?

My Code:

        protected void RadComboBox1_DataBound(object sender, EventArgs e)
        {
            RadComboBoxItem item = new RadComboBoxItem(NEU_ANLEGEN, "new");
            item.ForeColor = System.Drawing.Color.Red;

            ((RadComboBox)sender).Items.Add(item);
        }

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 01 Jul 2008, 03:47 PM
Hi Rene Falkner,

You can use the Insert method of the Items collection:

RadComboBox1.Items.Insert(0, item);

Greetings,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox
Asked by
Kanal8
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or