1

I have a sharepoint webpart and I use below controls:

<asp:DropDownList runat="server" ID="ddlCategory">
</asp:DropDownList>

<asp:ListBox runat="server" ID="ddlHSESubCategory" SelectionMode="Multiple">
</asp:ListBox>

I will be setting options later using jquery ajax call. when page is post back, I get below error:

Event validation is enabled using <pages enableEventValidation="true"/>
in configuration or <%@ Page EnableEventValidation="true" %> in a page.

Since I am building webpart, I can not set enableEventValidation=false since I do not have access to pages directive, and this webpart can be inserted to any page.

how do I overcome this ?

vsminkov
  • 10,912
  • 2
  • 38
  • 50
Vikas Kottari
  • 495
  • 2
  • 10
  • 24
  • there is a post with similar problem, Does this help you ? [Link](http://stackoverflow.com/questions/228969/invalid-postback-or-callback-argument-event-validation-is-enabled-using-page) – 3essamA Aug 16 '16 at 08:45

1 Answers1

-2

When you are using dropdownlist or listbox, when binding this control then you have to put this in

if(!IsPostBack())
{
// Your code to bind or some activity
}
Jameel
  • 288
  • 1
  • 2
  • 11