ASP.NET

Moderators: None (Apply to moderate this forum)
Number of threads: 1733
Number of posts: 3304

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Populating text box from drop down list box Posted by Amnesty on 1 Dec 2004 at 10:09 AM
Hello,

I have a webform I built using ASP.net and C#. I have a drop down list box in my form. What I want to try and do is when the user selects a certain item in the drop down list box I would like to populate a text box depending on what the user selects. For example I have a question that ask the user to select their level of education and they select it from the drop down list box. If they happen to select "High School/GED" I would like to populate a text box with "N/A" and if they selected "College" I would like to keep the text box blank and have them fill in the type of degree they hold. How would I go about doing something like this? Any help would be great. Thank you

James
Report
Re: Populating text box from drop down list box Posted by asp.net on 7 Dec 2004 at 10:03 AM
James,

You can do like this.
'High School/GED
If dropdownlist1.selectedindex=0 then
textbox.visible = true
textbox.text="N/A"
elseif dropdownlist1.selectedindex=1 then
textbox.visible = true
textbox.text=""
end if



: Hello,
:
: I have a webform I built using ASP.net and C#. I have a drop down list box in my form. What I want to try and do is when the user selects a certain item in the drop down list box I would like to populate a text box depending on what the user selects. For example I have a question that ask the user to select their level of education and they select it from the drop down list box. If they happen to select "High School/GED" I would like to populate a text box with "N/A" and if they selected "College" I would like to keep the text box blank and have them fill in the type of degree they hold. How would I go about doing something like this? Any help would be great. Thank you
:
: James
:

Report
Re: Populating text box from drop down list box Posted by singhrohit82 on 8 Dec 2004 at 12:57 AM
Hi James,

At first you need to set the AutoPostback Event of dropdown control to true. then on its "SelectedIndexChanged" Event. you can

use

ctrlname.selecteditem.text to check what value is selected and then u can show ur own custom text in the text box.






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.