Click here to Skip to main content
15,936,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Drop down list which display the company name and a Detail view to display other details of the company in one web page.
i already loaded the data in dropdownlist.
My requirement is when the abc company name selected in dropdown list abc companys details has to display in detail view.

Could you please advice how to do?


1 solution

make sure you set AutoPostBack Property of DropDownList to True in aspx

<asp:dropdownlist id="ddlCompany" runat="server" onselectedindexchanged="ddlCompany_SelectedIndexChanged" autopostback="true" xmlns:asp="#unknown" />

the below is your event handler in code behind

protected void ddlCompany_SelectedIndexChanged(object sender, EventArgs e)
   string strCompID = ddlCompany.SelectedValue.ToString();
   //bind here your DetailView's data bsed on the selected ID strCompID.
Share this answer
Comments 10-Nov-11 2:58am    
Thanks i will try..
Pandya Anil 10-Nov-11 3:40am    
welcome anytime, mark as answer if solves your problem

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