使用脚本管理器后出现Javascript错误:无法解析从服务器收到的消息 [英] Javascript Error after using Script Manager- : The message received from the server could not be parsed

查看:98
本文介绍了使用脚本管理器后出现Javascript错误:无法解析从服务器收到的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按钮OnClientClick事件上打开ShowModalDialog,而它的javascript是:-

I am opening a ShowModalDialog on a button OnClientClick event and the javascript for it is:-

<script language="javascript" type="text/javascript">
        function openmodalWinLunch() {
            var variable1 = "Lunch";
            window.showModalDialog("ClockPopUP.aspx?code=" + variable1, "dialogWidth:290px;dialogHeight:270px,");
        }
</script>


在Clock.aspx页面上,我有一个ASP按钮,在上面写了代码:-


On the Clock.aspx page i have a asp button on which i had written code :-

protected void btnStop_Click(object sender, EventArgs e)
    {
        _nonProduction = new NonProduction();
        if (Session["LastNonProdTimeID"] == null)
        {
        }
        else
        {
            int NonProdTimeEntryID = Convert.ToInt32(Session["LastNonProdTimeID"]);
            //Updating the TimeSpent 
            isTimeSpentUpdated = _nonProduction.UpdateTimeSpentInDB(NonProdTimeEntryID);
            if (isTimeSpentUpdated == true)
            {

                string timespent = Convert.ToString(_nonProduction.GetTimeSpent(NonProdTimeEntryID));
                //string msg = "Total time consumed  in " +HiddenTaskname.Value.ToString()+": " + timespent.ToString() + " Minutes";
                Response.Write("<script language='javascript'>window.close();</script>");
                Response.End();

            }
            else
            {
            }
        }
    }


以前,一切正常,此代码按我的要求运行.只是我在Clock.aspx上添加了Scriptmanager,因为我正在显示一个向用户显示经过时间的时钟.之后,当我单击CLock.aspx页面上的btn_Stop时,我收到此错误消息:-"Microsoft JScript运行时错误:Sys.WebForms.PageRequestManagerParserErrorException:无法解析从服务器收到的消息."

请指导我如何解决此问题.

我发现此错误的根本原因是什么.发生这种情况是因为即时通讯正在使用Resonse.Write和其他信息


Previously every thing is working fine and this code is working as per my requirement. Just i had added Scriptmanager on the Clock.aspx as i m showing a clock which shows the elapsed time to the user. After that when i m clicking on the btn_Stop on CLock.aspx page i am getting this error message:-"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed."

Please guide me that how i solve this issue.

I found that what is the root cause of this error. It is happening because i m using Resonse.Write and other information is Here

Guide me that how i fix this as i want to close the webpage after button click event.

推荐答案

Eilon Lipton有一篇有关此错误的好文章,请参见下文链接:
页面请求管理器解析器错误异常-what-it-is-and-how-to-avoid-it.aspx [ ajax-page请求管理器解析器错误error-error-in-asp-net-page [ ^ ]
> asp-net-ajax-error-sys-webforms-pagerequestmanagerparsererrorexception [ ^ ]
There is a good article about this error by Eilon Lipton, see below for the link:
page request manager parser error exception-what-it-is-and-how-to-avoid-it.aspx[^]

Also go through below links for more information:
ajax-page request manager parser error exception-error-in-asp-net-page[^]
asp-net-ajax-error-sys-webforms-pagerequestmanagerparsererrorexception[^]


希望这是您解决问题的方法.
http://kb.daypilot.org/85369/sys-webforms-pagerequestmanagerparsererrorexception-on -png-e/
http://msdn.microsoft.com/en-us/library/system. web.ui.postbacktrigger.aspx
Hope this is solution of your problem.
http://kb.daypilot.org/85369/sys-webforms-pagerequestmanagerparsererrorexception-on-png-e/
http://msdn.microsoft.com/en-us/library/system.web.ui.postbacktrigger.aspx


我曾经使用过:-
I Had Used:-
ScriptManager.RegisterStartupScript(Page, GetType(), "CLOSE", "window.close();", true);


代替


in Place of

Response.Write("<script language='javascript'>window.close();</script>"); Response.End()


这可以帮助我解决错误.


and this helps me to fix the error.


这篇关于使用脚本管理器后出现Javascript错误:无法解析从服务器收到的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆