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.
Protected Sub MyDropDownList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyDropDownList.SelectedIndexChanged
Mytextbox.text = MyDropDownList.selectedItem.text
And make sure Your Dropdownlist must have Autopostback property = true
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 sql="select name from customer where custid="+str;
sqlcommand cmd=new sqlcommand(sql,connectionstring)
Thank U very much praveen,
Now i have another problem that i am not able to select other cid from the drop down list.If i select another "cid" from the DDL also it is not effecting.It is always displaying the first item of the list.
How to solve this.please help me.
May be you have not set the AutoPostBack property to true.
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dropdownlst_selectectchange">
I have given the property AutoPostBack to true.still it is giving only first item in the list.I did the code in page_load event.
Is it require to add the code in betwwen if(!page.IsPostBack) condition .
reply me soon
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: