473,387 Members | 1,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Binding List Box to Two Different Drop Down Boxes

I need to bind my list box to two different drop down boxes. How do I bind my second dropdown box so my list box is populated with the author's name selected from my lbAuthorsList like it does when authors are selected from the lbGenrelist?

My code:

Expand|Select|Wrap|Line Numbers
  1. asp:DropDownList runat="server" ID="lbAuthorsList" style="float:left;" 
  2.         DataSourceID="AuthorsList" DataTextField="DisplayName" DataValueField="UserID" 
  3.         onselectedindexchanged="AuthorsList_SelectedIndexChanged" 
  4.         AppendDataBoundItems="True"  AutoPostBack="True"
  5.         ontextchanged="AuthorsList_SelectedIndexChanged" >
  6.          <asp:ListItem Text="Select Authors" Value="~Select Authors~" />    
  7. </asp:DropDownList>   
  8.      <asp:DropDownList runat="server" ID="lbGenreList" 
  9.                  style="float:left;" DataSourceID="odsGenres" 
  10.                  DataTextField="Authorame" DataValueField="AuthorName" 
  11.                  onselectedindexchanged="genreList_SelectedIndexChanged" 
  12.                  AutoPostBack="True" AppendDataBoundItems="true" 
  13.         onprerender="btnSortData_Click">
  14.    </asp:DropDownList>  
  15.        <asp:ListBox runat="server" ID="lbAuthorNameList" DataTextField="AuthorName" 
  16.             DataValueField="AuthorID" DataSourceID="Authors" SelectionMode="Multiple"  AppendDataBoundItems="true" /> 
  17.  
Expand|Select|Wrap|Line Numbers
  1.   {
  2.  
  3.         lbAuthorsList.DataBind();
  4.     }
  5.  
  6.       protected void genreList_SelectedIndexChanged(object sender, EventArgs e)
  7.     {
  8.  
  9.     lbAuthorsList.DataBind();  
  10.     } 
Jan 22 '14 #1
0 996

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Leigh | last post by:
I am building a data entry application using Java servlets. I had hoped to use drop down boxes to provide the user with data entry selections pulled from a database, but am now questioning, given...
5
by: MasterChief | last post by:
I have 3 drop down boxes on the same page. Each one is being populated by a database. One is called Location, One is called Device and the other one is called Job Title. When the user selects...
7
by: callawayglfr | last post by:
I am building a database in access where I have a drop down box that relates to a text box, that part I have working but when someone selects information from the first drop down I need it to limit...
2
by: ckerns | last post by:
I have a page with a bunch of drop down boxes. They are named: MonEquipAMWk1 MonEquipPMWk1 thru FriEquipAMWk1 FriEquipPMWk1
3
by: amcoldspy | last post by:
Hi, am trying to create dynamic drop down boxes.. there are 3 drop down boxes. The second drop down box elements are to be update based on the selection made in the first drop down box...
10
by: kashhere | last post by:
hi all, i had two drop down boxes on the selection of one item in the first drop down box the related items should be changed in the second one can any one please suggest me towards the solution...
1
by: ghjk | last post by:
In my application I have two drop down boxes. 2nd drop down box should filled according to the selected value on the 1st drop down box. But My 2nd drop down box not update.This is my code ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.