Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6762973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:25:19+00:00 2026-05-26T14:25:19+00:00

I am trying to create a dynamic UI using UpdatePanel of AJAX toolkit. Let

  • 0

I am trying to create a dynamic UI using UpdatePanel of AJAX toolkit.

Let me explain the context of my application a bit. There are many profiles. Each profile has a number of product classes. Each product class has a number of products.
I am implementing a comparison of products.

Profiles are represented by RadioButtonList (dynamically created). For each product class of selected profile a DropDownList need to
be dynamically created that allows user to select a product of that class.

Everything is working fine on the first selection. However when I try to select another product and click submit the second time, the following error is thrown:

Microsoft JScript runtime error:
Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback
or callback argument. Event validation is enabled using in configuration or <%@ Page
EnableEventValidation=”true” %> in a page.

Any hints on why this error is thrown would be very helpful.

protected void Page_Load(object sender, EventArgs e)
{
    pnlDynamic.Visible = false;     
    if (!this.IsPostBack)
    {       
        LoadProfiles();  //Data binding is done for radio button list
    }
    else
    {
        btnSubmit.Enabled = true;
        GenerateProductUI(ProfileID); //DropDownLists are dynamically created and populated from database
        //ProfileID is the selected profile id
    }
}     


 <asp:UpdatePanel runat="server" id="UpdatePanel" updatemode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger controlid="rblProfiles" eventname="SelectedIndexChanged" />
    </Triggers>
     <ContentTemplate>      
        <asp:Panel ID="Panel1" runat="server">
            <asp:RadioButtonList ID="rblProfiles" runat="server" AutoPostBack="True"
                onselectedindexchanged="rblProfiles_SelectedIndexChanged">
            </asp:RadioButtonList>
        </asp:Panel>        
        <br />
        <asp:Panel ID="pnlDynamic" runat="server" Visible="false">                                  
            <asp:Panel ID="Panel2" runat="server">
                <asp:Table ID="table" runat="server"/>      <!-- Product dropdowns generated in table -->             
            </asp:Panel>                
        </asp:Panel>        
        <br />
    </ContentTemplate>
</asp:UpdatePanel>

<asp:Button ID="btnSubmit" runat="server" Text="Submit" onclick="btnSubmit_Click" CssClass="btnSubmit" AutoPostBack="True" /> 

<asp:UpdatePanel runat="server" id="UpdatePanel1" updatemode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger controlid="btnSubmit" eventname="Click" />
    </Triggers>
     <ContentTemplate> 

    <asp:Panel ID="pnlResult" runat="server" Visible="false">
     <!--Result displayed-->
    </asp:Panel>      
    <br />
    </ContentTemplate>
</asp:UpdatePanel>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:25:19+00:00Added an answer on May 26, 2026 at 2:25 pm

    IMPORTANT! EVERYONE WHO EVER DISABLES EVENT VALIDATION SHOULD UNDERSTAND WHAT HE IS DISABLING!

    Imagine that you have a blogging application (or a banking application) and there is a list of comments (or bank accounts) all users can see the comments (or the accounts) but only moderators (or managers) can delete them. So you write a check to switch the delete button visible property depending on the access of the user. Users who are not moderators (managers) cannot delete the comment (account). Problem solved.

    HOWEVER if you disable event validation a malicious user can send a post request claiming to have pressed the delete button despite the fact that it was never enabled for him. Normally the event validation would kick in and produce an exception but if it is disabled ASP.NET would not check if the button was visible and will just run the button click handler code and the comment (account) would be deleted. This can be prevented if you check if the user can delete in the button click event but you should also consider that another developer may come later and add another button (edit?) without noticing that event validation was disabled. Also now all other buttons on the page require the appropriate checks. Be very careful if you disable event validation!

    The error occurs because you are triggering a postback from a control which does not exist when the original page was rendered. One way to fix it would be to disable event validation for this page but you should make sure to check the credentials of the user requesting the change in the event itself otherwise it is a security issue because a user will be able to “press” a button that was not rendered at all (for example on products he does not have access to).

    You can disable event validation through the page directive:

    <%@ Page EnableEventValidation="false" ... %> 
    

    I believe it is also possible to set the update mode of the update panel to always instead of conditional which maybe will fix the issue (can you try it and tell us?) but this will increase the data sent over the network. If it is a good trade off depends on your use case, on the number and size of the update panels you have on the page (the more you have the worse). If it is an internal app or this UI is accessed relatively rarely I would go for this approach (assuming it works because I have not validated that).

    BTW this is not actually a script error. You are getting a client side script error simply because the error surfaces through an AJAX request. This is purely a server error that is raised because of a potential security issue with your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to learn how to create dynamic websites using Glassfish (a Java application
I am trying to create a dynamic set of dropdown boxes, using jQuery/AJAX and
I'm trying to create a dynamic grid using ExtJS. The grid is built and
I am trying to create a new contact using Dynamic Entity. The sample i
I am trying to create dynamic excel sheet, with the help of php using
I am trying to create a dynamic menu by reading an XML file using
I'm trying to create a dynamic tag cloud using jquery, I want it to
I'm trying to create a dynamic library using Qt on OS X 10.6.7 and
I'm trying to figure out how to create a dynamic context, and what I
I'm trying to create dynamic balls by using a for loop. For some reason

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.