Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi All,

I'm new in .Net. I've a faced a problem. I'm using an aspx page that is inherited from master page in Visual Studio 2010. I've found that PostBack is not working for LinkButton click event & DropDownList indexChanged. Though normal Button & ImageButton is working fine. Please help me how DropDownList & LinkButton will work...

Here is my full code.
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder_Body" runat="server">
<asp:DropDownList ID="ddlPageSelector" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlPageSelector_SelectedIndexChanged">
                                                    </asp:DropDownList>
</asp:Content>
protected void ddlPageSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            Response.Write(ddlPageSelector.SelectedValue);
        }
 
But same code is working in VisualStudio 2008.
Please help me out ...
Posted 3-Aug-13 12:39pm
Edited 4-Aug-13 0:56am
v3
Comments
Boipelo at 3-Aug-13 18:57pm
   
You showed two different DropDownLists, ddlPageSelector and DropDownList1 is not the same... You should be having an error... Do you have AutoPostBack="True" for DropDownListDropDownList1
Member 9330747 at 4-Aug-13 6:56am
   
ohh sorry, i missed it. i've corrected the question. i've a dropdown named ddlPageSelector. and another one "DropDownList1" is for testing purpose. anyway thanks for correcting me. can you please let me know why are dropdown & link buttons not working only ?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

From the code it seems that your ASPX page is trying to find an event handler named ddlPageSelector_SelectedIndexChanged while your code behind is DropDownList1_SelectedIndexChanged.
 
I would suggest you to rebuild the solution and that should throw an error if the handler does not exist.
  Permalink  
Comments
Member 9330747 at 4-Aug-13 6:57am
   
ohh sorry, i missed it. i've corrected the question. i've a dropdown named ddlPageSelector. and another one "DropDownList1" is for testing purpose. anyway thanks for correcting me. can you please let me know why are dropdown & link buttons not working only ?
Nitesh Luharuka at 5-Aug-13 1:58am
   
Try placing the bookmark on 1st line of Page_Load and step inot to see from where the code is returning back.

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



Advertise | Privacy | Mobile
Web02 | 2.8.140709.1 | Last Updated 4 Aug 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid