Today, a button is added to the Repeater control, but you are prompted at execution
System.ArgumentException: The postback or callback parameter is invalid. Using < pages enableeventvalidation= "true" in configuration/>
<asp:repeater id= "rplist" runat= "Server" onitemcommand= "Rplist_itemcommand" > <ItemTemplate> <div class= "article pic" id= ' <% #Eval ("SID")%> ' >
Background code: [CommandArgument is the parameter commandname is the command name]protected void Rplist_itemcommand (object source, RepeaterCommandEventArgs e) { if (e.commandname = =) Updatepass ") { string id = e.commandargument.tostring (); Try { var vStu = from S in Ydtvu. Students where S.sid. ToString (). Trim () = = ID. ToString (). Trim () select S; Vstu.first (). Spass = Tomd5.getmd5hash ("123456"). ToString (). Trim (); Ydtvu. SubmitChanges (); Clientscript.registerstartupscript (this. GetType (), "failure", "$ (function () {Asyncbox.alert (' Congratulations, password initialization succeeded! Current password: 123456 ', ' Jiangsu rtvu Yandu College ');}) ", true); } catch (Exception exp) { Clientscript.registerstartupscript (this. GetType (), "failure", "$ (function () {Asyncbox.alert (' Sorry, password initialization failed, please try again later!") ', ' Jiangsu Rtvu University of Yandu ');}) ", true);} }
However, a little button, the page has an error, the prompt postback or callback parameter is invalid. After finding the data, find the following methods:
Whether the page is useful on the data-bound control , if so, put the IF (! IsPostBack) {//bind} if not, you can set the enableeventvalidation property on the page to false
Place the binding event of the original repeater control on the if (! IsPostBack) {//bind} , the error is no longer prompted.
System.ArgumentException: The postback or callback parameter is invalid when the Trigger button event appears in the Repeater control. Using < pages enableeventvalidation= "true" in configuration/>