Solved

Text Box Needs to Display the Selection from the Dropdown Box

Posted on 2014-01-29
1
438 Views
Last Modified: 2014-01-29
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:

protected void AuthorsList_SelectedIndexChanged(object sender, EventArgs e) 
    { 
  
  
  
    } 

Open in new window

asp:DropDownList runat="server" ID="lbAuthorsList"  
       style="float:left;" DataSourceID="odsAuthorsList"  
       DataTextField="DisplayName" DataValueField="AuthorName"  
       onselectedindexchanged="AuthorsList_SelectedIndexChanged"  
       AutoPostBack="true" AppendDataBoundItems="true" > 
</asp:DropDownList>    
  <asp:TextBox id="tb4" Text="Hello World!" runat="server"  
        ondatabinding="AuthorList_SelectedIndexChanged" /> 
  
 <asp:ObjectDataSource ID="odsAuthors" runat="server"  
            SelectMethod="GetAuthorsGenresList" TypeName="GenreSelection"> 
        </asp:ObjectDataSource> 
  
  

Open in new window

0
Comment
Question by:programmher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
dustock earned 250 total points
ID: 39818500
The selected Index changed event will allow you to do what your asking and I see AutoPostBack is already set to true.  If you are selecting Fiction from the drop down the code should be something like

tb4.Text = AuthorsList.Text;

Open in new window

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Open dialog with server side controls in it 3 48
asp.net mvc 2 35
Updating a single record in forEach using C#/Entity 7 26
Need help for captcha 2 24
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question