Link to home
Start Free TrialLog in
Avatar of Hojoformo
Hojoformo

asked on

Repeater - Adding a default selected value to a drop down list bow.

I have a repeater control with a drop down list box and I want to insert a record into the drop down list called "---Please Select -".  How can I insert this row to the drop down list box.  


for (int i=0;i<dtJobOrderDetails.Rows.Count;i++)
  {      
     Control m_Installed = m_LineItem.Items[i].FindControl("m_Installed");
     m_Installed.????  =  "---Please Select -";   --- ????? Need help????
   }

<asp:DropDownList ID="m_InstallType" DataValueField="INSTALLTYPEID" DataTextField="INSTALLTYPECODE" DataSource='<%# GetInstallType() %>' SelectedIndex='<%# GetSelectedIndex(Convert.ToString(DataBinder.Eval(Container.DataItem,"INSTALLTYPEID"))) %>' runat="server" CssClass="SmallInputDropDown"></asp:DropDownList>
Avatar of nauman_ahmed
nauman_ahmed
Flag of United States of America image

After binding the drop-down:

DropDown1.Items.Insert(0,new ListItem("--PleaseSelect--"));

--Nauman.
ASKER CERTIFIED SOLUTION
Avatar of nauman_ahmed
nauman_ahmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial