Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

(0) ShareShare
ReportReport
Posted on by 585

Getting below error during creation of case :

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.

 

0383.error.PNG

*This post is locked for comments

  • Suggested answer
    scotthoff01 Profile Picture
    4 on at
    Use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
    Microsoft is claiming this bug as a feature, so it's up to us implementers to apply the community-designed fix to make this area of the product usable.  The post by capoTincho appears to be cut off (did the forums migrate?), so I wanted to post a more complete solution here.
     
    The problem can occur when a field's Basic Forum Metadata has the Control Style set to "Render Lookup as Dropdown".  Custom filtering can load records into the dropdown which are not visible in the first 5000 records of the view associated with the field, and selecting from them will result in the error "Invalid postback or callback argument."  The way to fix this is to copy the code from the Control Style "Render Lookup as Dropdown", then remove this style from config and replace the default style lookup using JS on load.
     
    We can implement custom filtering on the dropdown like this:
    (function ($) {
        $(document).ready(function () {
            // Code for custom filtering goes here
        });
    }(jQuery));
    When we set Control Style "Render Lookup as Dropdown", the page renders a div.control containing a select and input tag, like this:
    <div class="control">
        <select></select>
        <input>
    </div>
    While using this Control Style, copy the select and input tags and save them for use in the JS.
     
    Next, set the Control Style to null.  This will render a lookup field in the default style, like this:
    <div class="control">
        <div class="input-group"></div>
        <div class="lookup-modal"></div>
    </div>
    In the JS, we just need to empty out this div.control and append the tags that we copied when using "Render Lookup as Dropdown".  This needs to happen before any custom filtering code, like this:
    var lookupParentControl = $("#new_mylookupfield").parent().parent();
    lookupParentControl.empty();
    lookupParentControl.append("<select ...></select>");
    lookupParentControl.append("<input ...>");
    // Code for custom filtering goes here
    Now the control will be unbound by the view's 5000 record limitation, thereby avoiding the error "Invalid postback or callback argument."
  • scotthoff01 Profile Picture
    4 on at
    Use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
    Please ignore, reposting this as a suggested answer.
  • Summer Garg Profile Picture
    585 on at
    RE: Use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

    Yes,

    We also did same kind of thing.

    1) Hide the lookup field

    2) Create our custom control

    3) And on change of that custom control, store the value in original lookup.

  • capoTincho Profile Picture
    12 on at
    RE: Use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

    This how I bypassed this error. Firstly, I removed the metadata that renders this lookup as a drop-down. Then, in the custom JavaScript I added this code to 'force' lookup field render as a drop-down but without the metadata:

    //Hide lookup control and save it into a variable
    $("#{lookupLogicalName}").parent().parent().hide();
    var c = $("#{lookupLogicalName}").parent().parent().parent();
    
    //Append a select tag with the following parameters to the above lookup  
    $("

  • TomV05 Profile Picture
    5 on at
    RE: Use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

    Nicolai - did you ever hear anything from Microsoft or find a fix?

    Tom

  • Suggested answer
    Schjoermann Profile Picture
    20 on at
    RE: Use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

    Hi Nicolas,

    I came to the conclusion that this is a limitation of lookup fields rendered as dropdowns in the portal.

    The dropdown list will only show the first 5000 records.

    So if you have 7500 records in the entity you are looking up, and you filter the list to only show 7. If the one you then select from the 7, is not part of the first 5000 in the original list you will get the above error.

    I created a case for Microsoft on this issue, and they say that this is by design.

    Best Regards,

    Nicolai

  • Nicolas FLEURENT Profile Picture
    5 on at
    RE: Use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

    Hello,

    I have exactly the same issue. Dis you find a fix ?

    I tried the solution proposed by Ravi Kashyap but it doesn't fix.

    Thanks,

    Nicolas

  • Schjoermann Profile Picture
    20 on at
    RE: Use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

    Did anyone come with a solution for this issue? I have exact same issue, have a JS that filters a lookup rendered as a dropdown.

    If I select some of the records from the dropdown I get exact same error as describe above, for others I don't get any error.

    How to stop the error?

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

    Can, you try the below setting on your web page and see if it helps?

    portalpagevalidation.png

  • Summer Garg Profile Picture
    585 on at
    RE: Use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

    Yes, i also tried this key but again getting same error

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans