Click here to Skip to main content
15,796,738 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

1 solution

Share this answer
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)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900