晨风

-------------------- 业精于勤,荒于嬉;行成于思,毁于随

导航

随笔分类 -  JavaScript

摘要:中文:Sys.WebForms.PageRequestManagerParserErrorException:无法分析从服务器收到的消息,之所以出现此错误,常见的原因是:通过调用Response.Write()修改相应时,将启用响应筛选器、HttpModules或服务器追踪。详细信息:分析附近的“输出内容”时出错。解决方法如下: 1.如果调用Response.Write()方法的服务器控件在使用UpdatePanel的页面,则只需要在UpdatePanel下增加一个<Triggers>节点,通过PostBackTrigger注册一下改控件就可以了。代码如下: 1. <asp: 阅读全文

posted @ 2012-03-08 15:47 shenyixin 阅读(9029) 评论(4) 推荐(3) 编辑

摘要:第一种方法:在GridView的模版列里加服务器端控件RadioButton,使用js控制单选<p>使用模版列里加RadioButton</p> <script type="text/javascript"> function setRadio(nowRadio) { var myForm,objRadio; myForm=document.forms[0]; ///alert(myForm);for(var i=0;i<myForm.length... 阅读全文

posted @ 2012-02-21 17:41 shenyixin 阅读(4902) 评论(0) 推荐(0) 编辑

摘要:在用Response.Redirect()或Response.Write()进行URL带参数的页面重定向时出现如题所示的错误。1:Ajax是无刷新的,而使用Response进行带参重定向时需要刷新页面。所以只须在UpdatePanel下设置“asp:PostBackTrigger”的“ControlID”为指定的控件名称即可,如: <Triggers> <asp:PostBackTrigger ControlID="btnSave" /> </Triggers>2:如果你用的是微软的ajax框架,弹出提示框应该用: ScriptManag 阅读全文

posted @ 2012-02-20 17:56 shenyixin 阅读(3990) 评论(0) 推荐(2) 编辑

摘要:gridview中模板列TextBox求和赋值给一个TextBox(txt总维修金额)html:<Chsoft:SmartGridView ID="gv设备_外协维修合同明细" runat="server" Width="100%" IsShowIndexColumn="true" DataKeyNames="外协维修合同明细ID" AllowPaging="false" IsShowExcelLinkButton="false" IsSingleP 阅读全文

posted @ 2011-12-28 22:58 shenyixin 阅读(1353) 评论(0) 推荐(0) 编辑

摘要:GridView添加模板列<asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" /> </ItemTemplate> <HeaderTemplate> <input id="SelectAll" type="checkbox" /> </HeaderTemplate> </as... 阅读全文

posted @ 2011-12-22 21:14 shenyixin 阅读(271) 评论(0) 推荐(0) 编辑

摘要:<asp:GridView ID="grid" runat="server" AutoGenerateColumns="false" GridLines="Horizontal" OnPreRender="grid_PreRender"> <Columns> <asp:TemplateField> <HeaderTemplate> <input type="checkbox" id="chkAll" / 阅读全文

posted @ 2011-12-22 21:08 shenyixin 阅读(628) 评论(0) 推荐(0) 编辑

摘要:javascript中存在几种对URL字符串进行编码的方法:escape(),encodeURI(),以及encodeURIComponent()。这几种编码所起的作用各不相同。escape() 方法:采用ISO Latin字符集对指定的字符串进行编码。所有的空格符、标点符号、特殊字符以及其他非ASCII字符都将被转化成%xx格式的字符编码(xx等于该字符在字符集表里面的编码的16进制数字)。比如,空格符对应的编码是%20。不会被此方法编码的字符: @ * / +encodeURI() 方法:把URI字符串采用UTF-8编码格式转化成escape格式的字符串。不会被此方法编码的字符:! @ # 阅读全文

posted @ 2011-12-16 20:32 shenyixin 阅读(267) 评论(0) 推荐(0) 编辑

摘要:JS保留两位小数对于一些小数点后有多位的浮点数,我们可能只需要保留2位,但js没有提供这样直接的函数,所以我们得自己写函数实现这个功能,代码如下:function changeTwoDecimal(x){var f_x = parseFloat(x);if (isNaN(f_x)){alert('function:changeTwoDecimal->parameter error');return false;}var f_x = Math.round(x*100)/100;return f_x;}功能:将浮点数四舍五入,取小数点后2位用法:changeTwoDecima 阅读全文

posted @ 2011-11-22 13:37 shenyixin 阅读(289) 评论(0) 推荐(0) 编辑

摘要:<script type="text/javascript" language="javascript"> //复制到剪切板js代码 function copyToClipBoard(s) { //alert(s); if (window.clipboardData) { window.clipboardData.setData("Text", s); alert("已经复制到剪切板!"+ "\n" + s); } else if (navi... 阅读全文

posted @ 2011-08-04 12:10 shenyixin 编辑