This is a migrated thread and some comments may be shown as answers.

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

2 Answers 144 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 06 Sep 2013, 05:20 PM
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 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 10 Sep 2013, 10:02 AM
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.
0
Jonathan
Top achievements
Rank 1
answered on 10 Sep 2013, 08:23 PM
Wow!  That worked.  I searched forever trying to find a solution.  

Thanks!
Tags
General Discussions
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Jonathan
Top achievements
Rank 1
Share this question
or