473,671 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Text Box Needs to Display the Selection from the Dropdown Box

19 New Member
I need my text box or some text somewhere on my form to display the value selected from my dropdown box.

Example - if an Author's genre of Fiction is selected, the textbox should display Fiction. How do I do this?

I can not use the PageLoad event because that event hides some other fields on the page. I think I need to include something in the selectedindexch ange event.

Here is my code:

Expand|Select|Wrap|Line Numbers
  1.   protected void AuthorsList_SelectedIndexChanged(object sender, EventArgs e)
  2.     {
  3.  
  4.  
  5.  
  6.     }
Expand|Select|Wrap|Line Numbers
  1. asp:DropDownList runat="server" ID="lbAuthorsList" 
  2.        style="float:left;" DataSourceID="odsAuthorsList" 
  3.        DataTextField="DisplayName" DataValueField="AuthorName" 
  4.        onselectedindexchanged="AuthorsList_SelectedIndexChanged" 
  5.        AutoPostBack="true" AppendDataBoundItems="true" >
  6. </asp:DropDownList>   
  7.   <asp:TextBox id="tb4" Text="Hello World!" runat="server" 
  8.         ondatabinding="AuthorList_SelectedIndexChanged" />
  9.  
  10.  <asp:ObjectDataSource ID="odsAuthors" runat="server" 
  11.             SelectMethod="GetAuthorsGenresList" TypeName="GenreSelection">
  12.         </asp:ObjectDataSource>
  13.  
  14.  
Jan 29 '14 #1
2 1285
Luk3r
300 Contributor
You'll want something like this in your SelectedIndexCh ange
Expand|Select|Wrap|Line Numbers
  1. textBox1.Text = comboBox1.SelectedItem.ToString();
Jan 29 '14 #2
programmher
19 New Member
Thanks Luk3r! That gave me what I needed.
Jan 29 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2035
by: Cindi | last post by:
Hi, Another newbie with a question that I hope someone can point me in the right direction. The goal is to populate a text box with data according to the selection in a combo box while still being able to navigate the records one by one. The combo box record source is a table/query asking for the ID, Subj, Title, CourseGoals from one table and displays Column 1. I've set up the text box
1
3565
by: Marek Kurowski | last post by:
Yo! I design web browser in VC++. I need a web browser, in which I can display html in a litle changed form. The best control is CHtmlView with IWebBorwser2 (do you know other way?). But in CHtmlView i can't find methods to read html text before display, change it, and put in CHtmlView changed html text to display on screen. Do you know a method or way to read html text before display, and put in
1
1430
by: tfs | last post by:
I have a dropdownlist: <asp:dropdownlist id="recurrance" runat="server"> <asp:listitem value="0" >None</asp:listitem> <asp:listitem value="1" >Daily</asp:listitem> <asp:listitem value="2" >Weekly</asp:listitem> <asp:listitem value="3" >Monthly</asp:listitem> <asp:listitem value="4" >Yearly</asp:listitem> </asp:dropdownlist>
2
2529
by: magix | last post by:
Hi, I'm using Access Database with ASP. There is one particular thing that I have issue with. My purpose is for user to update their own profile. Their existing profile information will be display in Edit Form format. The problem is if the field has space, the second word will not display, when I display in input text format. E.g if My first name "User_FirstName" in my table has entry, let say "David
3
3225
by: yangtono | last post by:
Hi, I'm trying to create a function that allows me to append the character at input text and display them on the div tag below. But the screen shouldn't refresh, therefore I'm using AJAX. But I can't seem to get it done, not really familiar with AJAX. Wonder if anyone here can help me out. Below is the code: <HTML> <HEAD>
2
1597
WyvsEyeView
by: WyvsEyeView | last post by:
I have a form on which users select various search parameters and then click a View button to display a report of the results. I would like to display the search parameters used on the report itself so users can easily see what the results are for. I have tried adding both labels and text boxes to the report and setting their values to the values of the search form but the report does not accept either Me.xxxxx.Value or Me.xxxxx.Caption. I tried...
2
3114
by: polluxsoftech | last post by:
i want to enter text in textbox by dropdown only when clicking on button i want that all this perform at client side by javascript.. this is dont in apsx page but i want it in .ascx this is following code that i used in aspx page and successfully run as i want: <script type="text/javascript"> function insertToken(element) {
3
3036
by: bongo555 | last post by:
Hi! Im trying to create an online quote calculator form. I have managed to get my second drop down populated depending on the choice in the first dropdown and when the calculate quote button is clicked i can display an alert that will bring up the pricing details. However, i want to display the details in a text area rather than an alert. How do i do this? The calculator so far is here: http://www.cheltenhamcars.co.uk/Quote.html
1
1563
by: Brett Woodruff | last post by:
ok, I'll explain this the best way I can... What I am trying to do is create an option box with several options, now by selecting option #1 will display Text File #1 in a textbox below the option box.... Option#2 displays Text File#2, and so on so forth, problem is I can figure out how to make the page load the text files.... any and all help will be greatly appreciated.... thanks in advance
4
2729
by: azkhan | last post by:
I am finding the way to change the text field value when we select the option from drop down list.Kindly help me out to solve this problem. I have Departments in one dropdown list and there is other dropdown list name as "Category".When i select the department then there should be related cetagory fields in Categroy dropdown list...kindly help me out... Thanks Azhar
0
8402
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6237
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5703
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.