这个是按钮的HTML代码<asp:ImageButton ID="EditRow" runat="server" ImageUrl="~/img/edit.bmp" OnCommand = "Edit_Click" />
</ItemTemplate>
在对应CS文件中存在Edit_Click 的方法如下: protected void Edit_Click(object sender, CommandEventArgs e)
{
///string arrgument = e.CommandArgument.ToString();
Response.Redirect("WebForm2.aspx");
}
本来预想的是点击gridview中按钮,然后跳转页面到WebForm2..可是一直都报错,如下Server Error in '/' Application.
--------------------------------------------------------------------------------Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
网上得解说是什么安全性问题。 - -|| 不过不知道怎么解决。。还请不吝赐教
解决方案 »
- 大牛进!跟技术主管发生分歧了,MVC中的Controller是否可以使用继承来写Action??
- WinForm中如何用WebBrowser.Navigate等待加载完了,再循环加载指定的uri啊?
- 请问谁用过WebLog Expert 这个日志分析软件
- 怎么用dso绑定xml到html页面里的select下拉框?
- 请问ajax怎么读???
- VB.net函数中的Try结构,若在catch到错误时执行了Return语句,Finally后的语句会否执行?
- 帮忙校正语法!!!不要嫌弃分数少,回答正确全给你!!!
- 如何在aspx页面中支持一种以上的语言
- [源代码]推荐一个可以代码着色的在线编辑器源代码
- 上传空间出现了错误,急
- 喜欢javascript的请来回答
- string flag = Request.Form["hName"] ?? string.Empty
楼主用如下方法试试:
protected void Edit_Click(object sender, CommandEventArgs e)
{
string url = "WebForm2.aspx";
this.Page.ClientScript.RegisterStartupScript(page.GetType(), "message", "<script language='javascript' defer>window.location=\"" + url + "\"</script>");
}
错是其他地方引起的!!
特别是进入Edit,会引起多方错误!!
直接使用模板列<a href
或Hyperlink
检查编码,添加EnableEventValidation="true"
</ItemTemplate>
protected void Edit_Click(object sender, CommandEventArgs e)
{
///string arrgument = e.CommandArgument.ToString();
Response.Redirect("~/WebForm2.aspx");//注意路径
}