Link to home
Start Free TrialLog in
Avatar of programmher
programmher

asked on

Text Box Needs to Display the Selection from the Dropdown Box

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

ASKER CERTIFIED SOLUTION
Avatar of dustock
dustock
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial