Click here to Skip to main content
11,496,146 members (815 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
See more: ASP.NET
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 2:29am
shabari7 at 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 at 23-Jan-13 7:37am
it is right
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
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
0 Dnyaneshwar@Pune 692
1 RyanDev 230
2 CHill60 163
3 Sascha Lefèvre 145
4 Sergey Alexandrovich Kryukov 124
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 23 Jan 2013
Copyright © CodeProject, 1999-2015
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