AJAX doesn't work on default page. Works if name page in URL. Any ideas why?

3 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    12 posts
    Member since:
    Apr 2013

    Posted 06 Sep 2013 Link to this post

    I had the classic situation where my site worked on the dev box, but not on the server.  Dropdowns populated with data would not post back to the server.  You'd choose an option and nothing would happen other than a page blink.

    The server is 2008 R2 fully patched with .net 4.5 installed.  The site has its own IP, not using default site in IIS.  The page that was not working was default.aspx.  IIS was set to use that as default, just like out of the box.

    So, I made a test page called test.aspx that just had a simple dropdown box set to autopostback.  When it changed value, the dropbox would be set to visible=false.  I just wanted to prove the postback was happening.  

    When I went to the site by http://sitename.com/test.aspx it worked!  

    So I set it to be the default page in IIS.  

    When I went to the site by http://sitename.com my test page did not work.  It would blink when I chose a different value, but the box did not disappear.

    So I went to the site directly again by http://sitename.com/test.aspx and it worked again!

    Basically, the ajax is not working if the page name is not directly specified and you arrive by it being the default page in IIS.

    Sample code:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
     
    <!DOCTYPE html>
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
     
                <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                    <Scripts>
                        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
                    </Scripts>
                </telerik:RadScriptManager>
     
            </div>
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            </telerik:RadAjaxManager>
            <br />
            <br />
            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                <asp:ListItem>test</asp:ListItem>
                <asp:ListItem Value="1">test1</asp:ListItem>
            </asp:DropDownList>
        </form>
        <br />
        <br />
    </body>
    </html>
  2. Ianko
    Admin
    Ianko avatar
    1904 posts

    Posted 10 Sep 2013 Link to this post

    Hello Jonathan,

    The described problem most probably originates from a breaking change in .NET 4.0. You could follow these articles and try the solutions they contain:

    Feel free to let me know if you need further assistance.

    Regards,

    Ianko
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. Jonathan
    Jonathan avatar
    12 posts
    Member since:
    Apr 2013

    Posted 10 Sep 2013 Link to this post

    Wow!  That worked.  I searched forever trying to find a solution.  

    Thanks!
Back to Top