CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > visual_studio.visual_studio_2005 Tags:
Item Type: Date Entered: 11/2/2009 1:16:26 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 0 Views: 5 Favorited: 0 Favorite
6 Items, 1 Pages 1 |< << Go >> >|
"ldy_hale" <>
NewsGroup User
Drop Down List boxes11/2/2009 1:16:26 PM

0

Hello all,

I am working on a project that will use alot of datatbound drop down boxes. This question i have is; if the use doesnt select an option from the ddl, I want to change the default option to "Select option" or something like that. I thought I could change it in the options but that didn't take. Can any one help with that?

 

 

Thanks in advance.

"DarrellNorton"
NewsGroup User
Re: Drop Down List boxes11/2/2009 1:21:31 PM

0

You can do it one of two ways.  Is this a databound dropdownlist?  If so, you can add a default item in the asp.net markup as long as you specify AppendDataBoundItems = true.

<asp:DropDownList ID="ddlCountry" runat="server" DataSourceID="getCountry" DataTextField="Country"
DataValueField="CountryId" AppendDataBoundItems=true >
<asp:ListItem Value="">Select One</asp:ListItem>
</asp:DropDownList>

Or you can add it using code in the code-behind:

http://www.4guysfromrolla.com/webtech/073101-1.shtml



Darrell Norton, MVP
Darrell Norton's Blog


Please mark this post as answered if it helped you!
"linick" <>
NewsGroup User
Re: Drop Down List boxes11/2/2009 1:21:52 PM

0

Can you elaborate your question?


Lini C K

========================================================================
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
"linick" <>
NewsGroup User
Re: Drop Down List boxes11/2/2009 1:24:14 PM

0

Check the code below:


DropDownList1.DataSource = dt;

DropDownList1.DataBind();

DropDownList1.Items.Insert(0, new ListItem("Select","0"));


Lini C K

========================================================================
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
"ldy_hale" <>
NewsGroup User
Re: Drop Down List boxes11/2/2009 1:38:22 PM

0

Thanks a bunch guys! 

"ldy_hale" <>
NewsGroup User
Re: Drop Down List boxes11/2/2009 2:09:39 PM

0

I have another question; I have several text boxes and a few checkboxes, and yes i have several tables that they are suppose to write to. My question is; can i complete this action with a bulk insert or what is the best way to do a multy insert to multiple tables when the user clicks the button? 

6 Items, 1 Pages 1 |< << Go >> >|




   
  Privacy | Contact Us
All Times Are GMT