开发者

On ajax request we get this error:Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed

I am having an issue which is really bizzare and after searching through the internet all day I have found nothing that has helped.

We went live with our website www.promatenvision.co.uk last week and when navigating to the website and clicking contact in the top right you are shown an enquiry form, the code for which is below (I have tried this with normal update panels rather than the telerik code and it does the same thing)

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="enquiry.ascx.cs" Inherits="Promat.enquiry" %>
<telerik:RadAjaxPanel ID="rap" runat="server" Width="100%" OnAjaxRequest="rap_AjaxRequest"
    LoadingPanelID="ralp">
    <div id="enquiryWrapper">
        <div id="detailsDiv">
            <h2>
                Your Details</h2>
            <p>
                <telerik:RadTextBox ID="txtName" runat="server" Width="180" EmptyMessage="Name" />
            </p>
            <p>
                <telerik:RadTextBox ID="txtTel" runat="server" Width="180" EmptyMessage="Telephone" />
            </p>
            <p>
                <telerik:RadTextBox ID="txtEmail" runat="server" Width="180" EmptyMessage="Email" />
                <asp:HiddenField ID="hidSubject" runat="server" ClientIDMode="Static" />
            </p>
        </div>
        <div id="requestDiv">
            <h2>
                Nature of your enquiry</h2>
            <textarea id="EnqTxtBx" class="enqText" cols="35" rows="8"></textarea>
        </div>
        <div id="submitDiv">
            <h2>
                Submit your request</h2>

        开发者_如何学运维    <input id="sendBtn" type="button" class="clickable" onclick="SendEnquiry()" value="SEND" />
            <input id="cancelBtn" type="button" class="clickable" onclick="SlideOut(0,'top','OUT')" value="CANCEL" />

            <div id="EnqMessageDiv" runat="server" style="display: none;">
                <img src="./themes/cross.png" alt="Invalid: " runat="server" id="MessageImg" style="width: 16px; height: 16px;" />
                <asp:Label ID="MessageLbl" runat="server"></asp:Label>
            </div>
        </div>
    </div>
</telerik:RadAjaxPanel>
<telerik:RadScriptBlock ID="rsb" runat="server">
    <script type="text/javascript">
        function SendEnquiry() 
        { 
            var oAjax = <%= rap.ClientID %>; 
            var txtBx = document.getElementById("EnqTxtBx");
            var EnqTxt = txtBx.value; 
            oAjax.ajaxRequest("Enq|"+EnqTxt+"|"); 
        }
    </script>
</telerik:RadScriptBlock>
<telerik:RadAjaxLoadingPanel ID="ralp" Runat="server" Skin="Default" Transparency="50">
</telerik:RadAjaxLoadingPanel>

Now then, if you click send, nothing happens at all and when doing this in IE you can see that a javascript error is actually thrown:

Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Line: 868 Char: 13 Code: 0

The line 868 is the following ajax function:

function Sys$WebForms$PageRequestManager$_endPostBack(error, executor, data) {
        if (this._request === executor.get_webRequest()) {
            this._processingRequest = false;
            this._additionalInput = null;
            this._request = null;
        }
        var handler = this._get_eventHandlerList().getHandler("endRequest");
        var errorHandled = false;
        if (handler) {
            var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
            handler(this, eventArgs);
            errorHandled = eventArgs.get_errorHandled();
        }
        if (error && !errorHandled) {
            throw error;
        }
    }

Now then, if you go to www.promatenvision.co.uk/promat.aspx (this is the default docunment in IIS 7 where it is hosted) and try it then it works. From now on, no matter what page you are on the code works as it stays on promat.aspx changing the query string to navigate the site. Go back to having .co.uk on the end of the URL and it breaks again.

Can someone please help me as I have no idea where to go next?

Thanks so much in advance,

Mark


I reviewed your code and think that you have to change it like this:

<telerik:RadCodeBlock ID="rcb" runat="server">
<script type="text/javascript">
    function SendEnquiry() 
    { 
        var oAjax = $find('<%= rap.ClientID %>'); 
        var txtBx = document.getElementById("EnqTxtBx");
        var EnqTxt = txtBx.value; 
        oAjax.ajaxRequest("Enq|"+EnqTxt+"|"); 
    }
</script>
</telerik:RadCodeBlock>

and use RadCodeBlock instead of RadScriptBlock.


We solved this issue by setting the pipeline mode of the app pool on our iis server to integrated instead of classic.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜