Click here to Skip to main content
12,953,379 members (50,470 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have one dropdown list and one textbox.
I have one table branch.
I select database in dropdownlist by configuring branch no come in drop down list.
I select the text in dropdown list and i have to show only branch name of selected branch no in text box.
then how to show?
plz help me.
Posted 23-Jan-13 1:29am
shabari7 23-Jan-13 7:34am
What I understood is: have branch numbers in dropdownlist as numbers,right?
2.Populate the branch name of the associated branch[num] from dropdonwlist,right?
amu jamdade 23-Jan-13 7:37am
it is right
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Amu ,

I want you to do it yourself . Below is algorithm . Read it step by step . Do the thing and will result into what you want.
I hope you are using some other language also for framework( Or C# ETC)

Note : Please replace framework language "{Your FW Lang}" in below steps with language you are using for FW.

1) Create one public method in your language to connect the database (Connection object)
2) Open "WWW.GOOGLE.COM" and search for "How to connect database in "{Your FW Lang}"
3) Modified connection string in the code you have found in above step so that it will take database name from use selection
4) Call this method on click event of "Database Selection Drop Down Box"
5) It will create connection object which will have database connection
6) Create one method to populate branch no taking source as database table. Use connection object created in above step
7) Call this method along with step no 4
8) Create one more method with will run query to find branch name from branch no. Use connection object created in step#3
9) Call this method on click event of "Branch No Selection Drop Down Box" and display result on to text box

Hope this will help if yes then vote and accept the answer otherwise revert back with your queries
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I assume you previously loaded data into dropdownlist soo next step is selected data to be shown in textbox, that step is:

double click on your dropdown control and writte the following code:

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
this.TextBox1.Text = this.DropDownList1.SelectedItem.Text;

I hope this will help you...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,930

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 23 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100