错误:
InvalID postback or callback argument. Event valIDation is enabled
using 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.Stack Trace:
[ArgumentException: InvalID postback or callback argument. Event
valIDation is enabled using 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.]
System.Web.UI.ClIEntScriptManager.ValIDateEvent(String uniqueID,
String argument) +8730646
System.Web.UI.Control.ValIDateEvent(String uniqueID,String
eventArgument) +113
System.Web.UI.WebControls.button.RaisePostBackEvent(String
eventArgument) +35
System.Web.UI.WebControls.button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl,String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(nameValueCollection postData)
+36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterasyncPoint)
+5563
我尝试过的:
在我的整个研究过程中,我了解到我可以使用enableEventValIDation =“false”和valIDateRequest =“false”,但由于安全原因,我不建议这样做.
我试图将两者都设置为False,它修复了问题(我认为我没有插入DELETE查询),但是我对一些安全设置被关闭感到不舒服,只是为了摆脱错误.
我的转发器位于Page_Load内部,由于我使用的是母版页,因此转发器也处于一种形式.
ASPX:
<asp:Repeater runat="server" ID="RepProductMenu" Onitemcommand="RepProducts_itemcommand"><ItemTemplate> [Lots of stuff]...... <asp:button ID="BtnDelete" runat="server" Text="Delete" Commandname="Delete" CommandArguement='<%# Eval("ID") %>' /</ItemTemplate></asp:Repeater>
Aspx.cs:
protected voID RepProducts_itemcommand(Object Sender,RepeaterCommandEventArgs e){ if (e.Commandname == "Delete") { int ID = Int32.Parse(e.CommandArgument.ToString()); // Add Delete query Response.Write("COMMAND"); }}
任何建议和IDéas表示赞赏.
解决方法 避免使用Delete作为Commandname,因为我相信这是保留的.你的button控件也有拼写错误. CommandArguement应该是CommandArgument
如果你的转发器在Page_Load被绑定而不是在@!(page.IsPostBack)里面,那么当点击删除按钮时它将被反d.这可能会导致问题,因为在运行itemcommand之前,转发器将会反d.哪会使它无效.
尝试更改您的代码,以便在!(page.IsPostBack)包裹绑定时.
总结以上是内存溢出为你收集整理的c# – 删除按钮 – 无效的回发或回调参数全部内容,希望文章能够帮你解决c# – 删除按钮 – 无效的回发或回调参数所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)