How to insert a item in databound dropdownlist at nth position
Sorry for not posting anything for long time. Actually i was busy about changing my job.
We have use the dropdownlist with millians of time some developer still does not know that how to insert the listitem at particular level.
Suppose your dropdownlist is having 5 items and it isbound with some datasource and you want to insert "--Select---" on the top of the order. You can do it easily with following code.
DropDownList1.Items.Insert(0, new ListItem("--Select---", "0"));
So "--Select--" will be added at the top of the dropdownlist box. You can add it at any index as you want via specifing index as first argument.
If you are using the asp.net 2.0 then it is having one property
AppendDataBoundItems set it to true and write directly a new list item in html code. It will work.