Hi friends,
I have created a form with a dropdown list and a text box and i have a table named customer with fields cid and name in database.
I successfully binded the cid column to dropdown list.now my problem is i want to bind the name into the text box based on cid selected in drop down list.
Please helpme doing this.
I need it very urgent.
Thanks.
sudharani
-3
Newbie Poster
Recommended Answers
Jump to PostHello dear
You can use select_IndexChangeEvent Like this...
Protected Sub MyDropDownList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyDropDownList.SelectedIndexChanged Mytextbox.text = MyDropDownList.selectedItem.text End Sub
And make sure Your Dropdownlist must have Autopostback property = true
Mark as solved if it helps you!!!
Jump to PostHi,
You might have stored the name of the customer in the database.
Just write a query to fetch the name from the table and add it to the textbox.protected void dropdownlst_selectectchange(object s, evetntargs s)
{
string str=dropdownlist1.selecteditem.text;
string sql="select name from customer where custid="+str;
sqlcommand cmd=new sqlcommand(sql,connectionstring)
…
All 6 Replies
reach_yousuf
2
Junior Poster
sudharani
-3
Newbie Poster
praveenkumarm
0
Newbie Poster
sudharani
-3
Newbie Poster
praveenkumarm
0
Newbie Poster
sudharani
-3
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.