当我单击“删除"按钮时,Javascript引发错误 [英] When I click Delete Button then Javascript Throws Error

查看:57
本文介绍了当我单击“删除"按钮时,Javascript引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我按下RadGrid Control中的Delete按钮时.会引发错误

我的代码是:


When I press delete Button in RadGrid Control . it Throws Error

My Code Is :


int id = 0;

           if (e.CommandName == "Delete")
           {
               GridDataItem item = (GridDataItem)e.Item;
               id = (int)item.GetDataKeyValue("RegId");
               int Execid = (int)item.GetDataKeyValue("ExecId");
               try
               {
                   Controllers.ComplianceRegController.DeleteComplianceRegistration(id, Execid);
                   Response.Write(@"<script language='javascript'>alert('Record Has Been Deleted')</script>");

               }
               catch
               {
                   Response.Write(@"<script language='javascript'>alert('Sorry! There Is Some Issue Related to Document.')</script>");
               }
           }





错误是:Microsoft JScript运行时错误:Sys.WebForms.PageRequestManagerParserErrorException:无法解析从服务器收到的消息.导致此错误的常见原因是通过调用Response.Write(),响应筛选器,HttpModules或服务器跟踪来修改响应.
详细信息:解析''< script language =''ja''附近的错误.





Error is : Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near ''<script language=''ja''.

推荐答案

就我而言,它就像


在Single Cote('''')中编写脚本语言=''javascript''而不是在double Cote中写..然后它可以正常工作..

还有另一种提醒消息的方式,例如

in my case it is like


Write script language =''javascript'' in Single Cote('' '') not into double cote..then it work fine..

and another way for alert msg like

ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:alert('Record Has Been Deleted.')", true);



谢谢



Thank you


这篇关于当我单击“删除"按钮时,Javascript引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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