Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am new to asp.net.
i have taken a dropdownlist above and gridview below.
if i select the particular value in dropdown list of customer id it should display the customer details in gridview.
plese help me ASAP.
Posted

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


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

the below is your event handler in code behind


C#
protected void ddlCompany_SelectedIndexChanged(object sender, EventArgs e)
{
   string strCompID = ddlCompany.SelectedValue.ToString();
   //bind here your GridView's data bsed on the selected ID strCompID.
}


mark as answer if solves your problem.
 
Share this answer
 
Comments
Uday P.Singh 10-Nov-11 5:58am    
5ed :)
RaviRanjanKr 10-Nov-11 6:21am    
My 5+
Member 8388026 10-Nov-11 7:05am    
please help me in binding the data to gridview
 
Share this answer
 
Comments
Member 8388026 10-Nov-11 10:34am    
Thank u so much that really helped me.Great tutor.

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