473,511 Members | 9,983 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 selectedindexchange 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 1282
Luk3r
300 Contributor
You'll want something like this in your SelectedIndexChange
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
2023
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...
1
3549
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...
1
1407
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"...
2
2510
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...
3
3215
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...
2
1588
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...
2
3107
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...
3
3034
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...
1
1559
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...
4
2721
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...
0
7251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7148
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...
0
7430
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...
1
7089
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5673
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,...
0
4743
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...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
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...

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.