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...

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;

This article has been dead for over six months. Start a new discussion instead.