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
Solved

Text Box Needs to Display the Selection from the Dropdown Box

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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