Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Drop Down List code

Posted on 2007-10-19
3
Medium Priority
?
198 Views
Last Modified: 2010-04-15
I'm populating a drop down list dynamically in code, but
I want to add this after:

   Text="Select Year"    Value="0"    Selected="True"

<asp:DropDownList ID="ddlDOBY" runat="server">

I can do it VB but I need it in C# . . which I'm still struggling to learn.  thanks
0
Comment
Question by:MikeMCSD
  • 2
3 Comments
 
LVL 26

Expert Comment

by:Rejojohny
ID: 20111064
Where are you dynmically populating the dropdown? just below that code
i.e below ddlDOBY.DataBind();

write
ddlDOBY.Items.Insert(0, new listitem("0", "Select Year"));
0
 
LVL 26

Accepted Solution

by:
Rejojohny earned 2000 total points
ID: 20111072
Sorry,
ddlDOBY.Items.Insert(0, new listitem("0", "Select Year"));
must be
ddlDOBY.Items.Insert(0, new ListItem("Select Year", "0"));
0
 
LVL 16

Author Comment

by:MikeMCSD
ID: 20111176
that did the trick, thanks Rejo
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question