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/>

Source: Internet
Author: User

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/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.