I m using a dropdown to display ‘Location’ field of a table. I want to set first item of dropdowm as ‘-Select Location-‘. I can’t set tables first record as ‘Select’ because table is stroed in xml format. And table file is generated dynamicaly. I am currentaly using as
ddlLocationName.Dispose(); ddlLocationName.AppendDataBoundItems = true; ddlLocationName.Items.Add('Select Location'); ddlLocationName.DataSource = _section.GetLocations(); ddlLocationName.DataBind(); ddlLocationName.AppendDataBoundItems = false;
but data is binded repeatedly. What will be the solution for this problem? Thaks in advance.
After you have databound, then call ddlLocationName.Items.Insert(0, ‘Select Location’);
Example: