Hi I am a beginner to asp.net.
Could any one please help me ...
I have a database table with two colums ( column one has all the countries and column two has all the capitols of that particular country.)

In my .aspx page I have a dropdown list and a text box.
Drop downlist will display all the countries and if I select a country then its capitol should be displayed in the textbox.

Thanks in Advance...
Your help is much appreciated....

From DropDownList properties assign its DataSource to your created datasource, then choose which column to be shown and which to be the value of the items. All from properties or the smart arrow which located on the top left of the DropDownList.

From DropDownList properties assign its DataSource to your created datasource, then choose which column to be shown and which to be the value of the items. All from properties or the smart arrow which located on the top left of the DropDownList.

Hi Ramy Thanks a lot for ur reply.....
but how do I need to display the corresponding value of dropdownlist selected value in the text box, without posting back to the server.

Thanks so much again.....in advance....

That is handled in a handler in your dropdown. You can try the selectedvaluechanged - handler for that.

The value of your dropdownlist then gets sent through the sender of your listener.

Hope this helps, jens

That is handled in a handler in your dropdown. You can try the selectedvaluechanged - handler for that.

The value of your dropdownlist then gets sent through the sender of your listener.

Hope this helps, jens

Thanks Jens for you reply...

Not a problem, hope it helped.

Hi,

u can bind dropdown list to a datasource by giving as

dropdownlist.DataTextfield="Countris";
dropdownlist.DataValuefield="Columns";

and in dropdownlist_selectindex change event write

textbox.text=dropdownlist.selectedvalue;

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.