Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
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.NET
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder_Body" runat="server">
<asp:DropDownList ID="ddlPageSelector" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlPageSelector_SelectedIndexChanged">
                                                    </asp:DropDownList>
</asp:Content>

C#
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
Updated 4-Aug-13 0:56am
v3
Comments
Boipelo 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 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

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.
 
Share this answer
 
Comments
Member 9330747 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 Kejriwal 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


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