Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I actually added one dropdownlist in my project and then just fired event onselectedindexchanged and i tried a lot to fire it,
at last i tied its really not working please help me.. and one more thing i have added one template also in my project. is there any problem regarding that template?

What I have tried:

here is my code:
<asp:DropDownList ID="drl1" runat="server" OnSelectedIndexChanged="drl1_SelectedIndexChanged" >

CODE:
if (!IsPostBack)
{
ShowDDL();
}

private void ShowDDL()
{
var size = from PS in drop.Product_Size
select new { PS.Size, PS.Size_Id };
drl1.DataValueField = "Size_Id";
drl1.DataTextField = "Size";
drl1.DataSource = size.ToList();
drl1.DataBind();
drl1.Items.Insert(0, "-Select Size-");
}


try
{
string size = drl1.SelectedValue;
var products = (from PM in drop.PRODUCT_DBM
join PS in drop.Product_Size on PM.product_size_id equals PS.Size_Id
where PS.Size == size
select new
{
PS.Size
});
}
catch (Exception ex)
{
}
Posted
Updated 28-Mar-16 21:59pm

1 solution

I think AutoPostBack="true" is missing..

try with this

ASP.NET
<asp:DropDownList ID="drl1" AutoPostBack="true" runat="server" OnSelectedIndexChanged="drl1_SelectedIndexChanged">
  </asp:DropDownList>
 
Share this answer
 
Comments
Karthik_Mahalingam 6-Apr-16 6:12am    
Please close this post.

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