Solved

Text Box Needs to Display the Selection from the Dropdown Box

Posted on 2014-01-29
1
440 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…

726 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