Welcome Guest Search | Active Topics | Sign In | Register

Invalid postback or callback argument Options
Joan Darling
Posted: Tuesday, June 19, 2012 11:21:19 AM
Rank: Advanced Member
Groups: Member

Joined: 3/9/2010
Posts: 119
I'm getting this error but can't determine why. When I evaluate Request.Form("eo_cb_id") it has a length of 0 instead of being nothing.

Exception: System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.

I am using the call back in the following manner. The auto refresh value in function afterAddTask is equal to 1 so a postback happens. it is on this post back when the error occurs.

Code: HTML/ASPX
<a href="#" style="cursor:hand;">
  <asp:Image ID="btnAddTask" runat="server" ImageUrl="~/images/timecard1.gif" onclick="addTask()" />
</a>


Code: HTML/ASPX
<eo:CallbackPanel ID="CallbackPanel_AddTasks" runat="server" Height="26px" Width="100%" ClientSideAfterUpdate="afterAddTask">
  <table width="100%">
    <tr>
      <td id="cell_addtask_status" runat="server" align="left" enableviewstate="false">
        <asp:Label ID="lblAddTaskStatus" runat="server" Text="" EnableViewState="false"></asp:Label>
        <asp:BulletedList ID="bllAddTaskMessages" runat="server" EnableViewState="false">
        </asp:BulletedList>
        <br />
      </td>
    </tr>
  </table>
</eo:CallbackPanel>



Code: JavaScript
function addTask() {
  try {
    var list = eo_GetObject("&lt;%=lsbTasks.ClientID %&gt;");
    var item = list.getSelectedItem();
    var item_value = item.getValue();
    var item_value_parts = item_value.split(";");
    var id_parts = "&lt;%=lsbTasks.ClientID %&gt;".split("_");
    var parm = item_value_parts[0] + "|";
    var callback = false;

    for (x = 1; x < 8; x++) {
      var txt = document.getElementById(id_parts[0] + "_" + id_parts[1] + "_txtInputDay" + x);
                
      if (txt != null) {
        var value = txt.value;
        if (value.length == 0  ) {
          value = "-1";
        } else {
          callback = true;
        }
                    
        parm += value + ";";
      } else {
        parm += "-1;";
      }
    }
            
    if (callback == true) {
      eo_Callback("CallbackPanel_AddTasks", parm.substr(0, parm.length-1));
    } else {
      alert("Please enter time then click the save button...");
    }
  }catch(err) {
    alert(err);
  }
}

function afterAddTask(callback) {
    var list = eo_GetObject("&lt;%=lsbTasks.ClientID %&gt;");
    var item = list.getSelectedItem();
    var item_value = item.getValue();
    var item_value_parts = item_value.split(";");
    var id_parts = "&lt;%=lsbTasks.ClientID %&gt;".split("_");

    if (document.getElementById("&lt;%=hfAutoRefresh.ClientID %&gt;").value == "1") {
        postBack();
    } else {
	
    }
}

function postBack() {
  __doPostBack('__Page','NewTask');
}
eo_support
Posted: Wednesday, June 20, 2012 8:18:16 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

You can not do post back immediately inside afterAddTask. When that function is called, the AJAX call is at the last moment of its life cycle but has not finished yet. So you must use setTimeout to delay your call.

If you still have problems, please post a complete test page. We tried to run your test page but we were not able to guess out what data we should put into the listbox.

Thanks!
Joan Darling
Posted: Thursday, June 21, 2012 11:29:24 AM
Rank: Advanced Member
Groups: Member

Joined: 3/9/2010
Posts: 119
Thanks, that explains a lot.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.