Click here to Skip to main content
15,792,382 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
Hi, I am Manpreet doing B.Tech in computer science.
I am having problem in c# about dropdownlist that when I click on selected item, its related information displays in textboxes. How should I do coding for this?
Updated 29-Aug-11 20:41pm
Prerak Patel 30-Aug-11 1:41am    
Use proper case.

Use the SelectedIndex property[^].

Once you have the value you have selected, fetch the values related to this index (the ones that you want to show in textboxes).
These will need to be fetched from the database or a temporary memory store.

Display these values.
Share this answer
<asp:DropDownList  ID="DropDownList1"  runat="server"   AutoPostBack="true"          OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"    >

<asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown"></asp:textbox>

<script runat="server">
    protected void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
        TextBox1.Text = "You Selected: " + DropDownList1.SelectedItem.Text;

You can use database to store records.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900