asp.net中"错误:回发或回调参数无效"
错误信息:
回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。
发生情况:
在模板列添加时,将按钮的CommandArgument属性设置为<%# Eval("ID") %>引发上面的错误
解决方法:
1.在页面的<@page @>指令中加上EnableEventValidation="false"
2.if(!IsPost){ 数据绑定方法 }
网上查到的方法,记下来~
相关文档:
/// <summary>
/// 写Cookies
/// </summary>
/// <param name="response"></param>
/// <param name="request"></param>
&n ......
Javascript 在ASP.net 母板页下访问 控件ID:
对于 html control : 直接访问ID
document.getElementById("hfRespondID");
对于 Web control :
document.getElementById("<%= this.hfRespondID.ClientID %>") [注意大小写
]
&nb ......
web.config
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="mymail<you@163.com>">
......
URL:
http://www.cnblogs.com/JimmyZhang/archive/2007/09/04/880967.html
引言
我查阅过不少Asp.Net的书籍,发现大多数作者都是站在一个比较高的层次上讲解Asp.Net。他们耐心、细致地告诉你如何一步步拖放控件、设置控件属性、编写CodeBehind代码,以实现某个特定的功能。
这种做法,实际上是回答了“如何去做&rd ......
//平常调用javascript方法
ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert'Weclome!!!');</script>");
背景不为白色的方法:
Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('添加失败,请联系技术员!') ......