473,394 Members | 1,761 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,394 software developers and data experts.

related to drop down list

sir i have taken to drop down list and i want to select any data in drop down list1,
accordind to this data display related data in drop down list2.
how i can do this i am working in asp.net with c#
the coding i have done is
protected void Page_Load(object sender, EventArgs e)
{
strconn = new OleDbConnection();
strconn.ConnectionString = "Provider=msdaora.1; user id=payroll; password=payroll; data source=payroll";
strconn.Open();
strsql = "select * from section";
OleDbCommand cmd = new OleDbCommand(strsql, strconn);
OleDbDataReader reader = cmd.ExecuteReader();
DdlSectionID.DataValueField = "SectionID";
DdlSectionID.DataSource = reader;
DdlSectionID.DataBind();
reader.Close();
strconn.Close();

}
protected void DdlSectionID_SelectedIndexChanged(object sender, EventArgs e)
{
strconn = new OleDbConnection();
strconn.ConnectionString = "Provider=msdaora.1; user id=payroll; password=payroll; data source=payroll";
strconn.Open();
strsql = "select * from Employee where SectionID=" + DdlSectionID.Text + " ";
OleDbCommand cmd1 = new OleDbCommand(strsql, strconn);
OleDbDataReader reader1 = cmd1.ExecuteReader();
//DdlBillUnit.DataValueField = "BillUnit";
DdlBillUnit.DataSource = reader1;
DdlBillUnit.DataBind();
DdlSectionID.SelectedIndex = 0;
reader1.Close();
strconn.Close();
}
were i doing any mistake plz help me
Jun 15 '07 #1
1 967
kenobewan
4,871 Expert 4TB
I believe you need to change this line:
strsql = "select * from Employee where SectionID='" + DdlSectionID.Text + "' ";
Jun 15 '07 #2

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

Similar topics

3
by: Don Wash | last post by:
Hi There! I have a Server-side Drop-down box in ASP.NET (VB) page. What do I do to widen the Drop down box's Pull-Down list's width? I'm not talking about the Drop-down box's width but the box...
2
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
1
by: pmelanso | last post by:
Hello, I have a drop down list which is dynatically loaded from a database and I have a second drop down list that is also dynatically loaded depending on what is selected in the first drop down...
8
by: Ed Dror | last post by:
Hi there ASP.NET 2.0 VB & SQL Express Lest take Northwind Categories Products as example I create a table that hold these two together and I create a stored procedure like select ProductID,...
2
by: cpptutor2000 | last post by:
Could some PHP guru please help me? I am creating a dynamic dropdown list using a code snippet(Section A) as below: Section A: $sql_query=mysql_query("SELECT DISTINCT semester, year from...
5
by: ashok893 | last post by:
I'm using two drop down list ina form. I have generated the first drop down list from MySQL database. When i select an option from first drop down list, i have to generate second drop down list...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
3
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
1
by: JohnMV | last post by:
Hi, I have 3 related drop down menus all of which need to be populated from database.In the first list i populated the values from the database. But i have trouble to proceed further. The...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.