Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 5th, 2006, 09:30 AM
Authorized User
Join Date: Feb 2006
Location: , , .
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can i change the textbox into a dropdownlist

 Hi guys:

i was trying to change the text box in the Edit template in the form control to a dropdown list. However, when i tried to press the Edit Button to test it, an error page came with a message saying:

Server Error in '/ECBS' Application.

'DepaNameTextBox' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

what i did is the following change from text box to dropdown list:


<asp:dropdownlist ID="DepaNameTextBox" runat="server" text='<%# Bind("DepaName") %>' Width="137px"></asp:dropdownlist><br />

as you can see the dropdownlist is binded to 'depaName' column. so my next question is, how can i let the dropdown list display the name of the record that was first inserted when i press the edit button to edit that record.

many thanks to any helper

Reply With Quote
  #2 (permalink)  
Old March 5th, 2006, 04:20 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts

You cannot convert a textbox into a dropdownlist. You need to add a dropdownlist to the template. Then on the RowDataBound event get a reference to the textbox and a reference to the dropdownlist. Then you can do a findbytext to set the ddl.


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdownlist index change event problem. thanigaimani83 ASP.NET 1.x and 2.0 Application Design 0 November 7th, 2007 06:40 AM
dropdownlist change jeh3404 ASP.NET 2.0 Basics 1 July 18th, 2007 10:14 PM
adding dropdownlist item to a textbox alto ASP.NET 2.0 Basics 2 May 24th, 2007 01:14 AM
about dropdownlist selected change event chandra_yvr ASP.NET 2.0 Basics 0 April 2nd, 2007 07:20 AM
Newbie HELLLPPPP.... Textbox and DropdownList sane79 ASP.NET 1.0 and 1.1 Basics 3 October 3rd, 2005 12:20 AM

All times are GMT -4. The time now is 07:07 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.