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>
ASP.NET

Avatar of undefined
Last Comment
nauman_ahmed

8/22/2022 - Mon
nauman_ahmed

After binding the drop-down:

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

--Nauman.
ASKER CERTIFIED SOLUTION
nauman_ahmed

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck