Click here to Skip to main content
13,056,229 members (106,785 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello friends,

In my web page which uses master page, I have following dropdowns
1. ddlGEO<br />
2. ddlVC

In page load I'm filling the ddlGEO.
I'm populating ddlVC using JQuery through following code
       $(document).ready(function () {
       function fillVC() {
           try {
               var objGEO = document.getElementById('<%= ddlGeo.ClientID %>');  //$("#hdnEmpNo").val();
               var objGEOValue = objGEO.value; 
               var objHdn = document.getElementById('<%= hdnEmpNo.ClientID %>');  //$("#hdnEmpNo").val();
               var objHdnValue = objHdn.value;
                   type: "POST",
                   url: "FWB_DUOverhead.aspx/strgetVC",
                   data: "{strGEO: '" + objGEOValue + "', intEmpNo: '" + objHdnValue + "'}",
                   contentType: "application/json; charset=utf-8",
                   dataType: "json",
                   success: function Success(response) {
                       var result = response.d;
                       var objVC = result.split(";");
                       var VClength = objVC.length;
                       //document.getElementById('imgLoader').style.display = "block";
                       if (VClength > 0) {
                           try {
                               var ddlVC = document.getElementById('<%= ddlVC.ClientID %>');
                               var option = document.createElement("option");
                               ddlVC.options.length = 0;
                               option.value = 0;
                               option.text = "- Select -";
                               for (var i = 0; i < VClength - 1; i++) {
                                   var objVCDetails = objVC[i].split('|');
                                   var VCDetailsLength = objVCDetails.length;
                                   var option = document.createElement("option");
                                   option.value = objVCDetails[0];
                                   option.text = objVCDetails[1];
                               //document.getElementById('imgLoader').style.display = "none";
                           catch (e) { alert(e); }
                   error: function (data, status, jqXHR) {
                       alert('There was an error.');
           catch (e) {

I call this javascript function in following way:
<asp:DropDownList ID="ddlGeo" runat="server" Width="100px" 

On ddlVC selected index change I'm filling the grid

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.

Solution Tried:
<%@ Page EnableEventValidation="false" %>

Postback does not happen, grid does not getting filled and the ddlVC gets clear

Any idea how to overcome this problem?

Thanks in advance
Posted 19-Jun-12 18:15pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

dhage.prashant01 20-Jun-12 3:26am
Instead of filling the grid on ddlVC selectedIndex change event, I'm doing on button press event and its working fine.

But surely I'vl go through your solution =)

thanks buddy

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170728.5 | Last Updated 20 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100