System.ArgumentException: Invalid postback or callback argument - When clicking OK or Cancel on JavaScript Confirmation box

I can't figure out why I get this error.  Yes, the error description should tell me but I don't understand it or how to resolve my situation so bare with me.

First let me explain the code I have going on.In my PageLoad I have registered this script to the page: 

Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "DeleteConfirmation", "function confirmDelete(){if(confirm('Are you sure you want to Delete?')){return true;}else {return false;}}", True)

Then, in my DataGrid, I have wired up each ImageButton (that's wrapped in an ItemTemplate in my GridView) to an onclick event that calls that JavaScript.  I wired each button in each row in the ItemDataBound event of the GridView like this:Dim btnDelete As ImageButton = CType(e.Item.FindControl("btnDelete"), ImageButton)btnDelete.Attributes.Add("onclick", "confirmDelete();")But when I click OK, or Cancel in the JavaScript Confirmation box, either or, I get this on the aspx page:Exception Details: System.ArgumentException: 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.Stack Trace:
[ArgumentException: 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.]   System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +2127900   System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +106   System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +32   System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint
 
When is Microsoft going to get rid of VB.NET!
0
dba123
10/3/2007 4:51:58 PM
asp.net.client-side 24353 articles. 2 followers. Follow

0 Replies
1571 Views

Similar Articles

[PageSpeed] 37
Get it on Google Play
Get it on Apple App Store

Reply:

Similar Artilces:

System.ArgumentException: Invalid postback or callback argument
I can't figure out why I get this error.  Yes, the error description should tell me but I don't understand it or how to resolve my situation so bare with me.First let me explain the code I have going on. In my PageLoad I have registered this script to the page:  Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "DeleteConfirmation", "function confirmDelete(){if(confirm('Are you sure you want to Delete?')){return true;}else {return false;}}", True) Then, in my DataGrid, I have wired up each ImageButton (that's wrapped in...

Postbacks were too slow with long datalists so I used client side script but then get "Invalid postback or callback argument"
I have a complex app that uses long lists using datalist and a div above that shows the contents of a selected record in the list. (It's a regular asp.net 2.0 app - no ajax (way too slow))  The user can change stuff in the record before saving those changes and I have been using postbacks (via autopostback=true) to make the changes in the div above.  However, when the list gets large the app takes too long changing the div for a good user experience. e.g. changing a selection in one drop down re-populates another dropdown list. So I thought I'd pass the data down in a hi...

How To: Cancel postback using Client-Side validation javascript
Hey all,I'am trying to develop a simple login form using javascript. The goal is to cancel asp.net postback (if the user didnt enter a username), configured in the postbackurl property of the "ok" buton. I've seen a lot of examples in the internet, but none of them seems to work. Here's what Í'am trying to do: <script language="javascript" type="text/javascript"> function Validate() { var x = document.getElementById("TextBox1"); if (x.getAttribute("Value") == "") { return false; } return true; } ...

Perform JavaScript Client Side Confirmation from a VB.NET DataGrid
Hi, I when I delete an item from the database through a Datagrid I want to get a messagebox popingup to give me the choise to Confirm it...in case I clicked the wrong item....the way it works now it just deletes it....can any one help me with an Example I have no Idea how to do this...I found an article in C# but it didnt help me at all. here is my source code <asp:DataGrid ID="dgCustList" Runat="server" AutoGenerateColumns="False" DataKeyField="id" AlternatingItemStyle-BackColor="#F6F6F6" HeaderStyle-BackColor="#C4B58E" CellSpacing="0" CellPadding="2" GridLines="Vertical" Width="100%"...

Modal Popup on Client-Side
Hello, Is it possible to determine in the client API that a user clicked the OK/Cancel option, either via enumeration or boolean property?  I'm accessing this on the client only, and am trying to figure out how I can tap into this to perform a client action. Thanks.Brian"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4). You can do it by handling the following properties... OnOkScript - Script to run when the modal popup is dismissed with the OkControlID...

how to bind Javascript Confirm ok event with server side button click event
Hello I ve a popup menu to "add a group" or "Delete Group" when i click "Delete Group" menu i want one Javascript confirm box which will ask permission whether to delete or not. When user will press "Ok" on confirm box, i want to call one server side button_click event? How should i proceed with this? Hi dee1j,When you are in your javascript at this point:if (confirm('Do you want to delete')){   var myButton = document.getElementById('IdOfButtonIWantToClickWhenConfirmIsOk');   myButton.click();} Please gi...

How to display a client-side confirm dialog box if the user clicks on the first row in my datagrid
I could n implement that, this what I tried: I define my datagrid with :  <ItemTemplate> <a id="MenuItem".......><%#container............>  pls check my aspx html code bellow. Thn, In the ItemDataBound event handler of my datagrid, I test if e.Item.ItemIndex=0, if so, I create an object of type control and assign it to e.item.controls(0) , then I try to add the client side property: atributes(....) to that control. The pb is: the control object that I create doesn t take the client property :  attributes(“onclick”)=…. My question is:  What type are...

how to call a c# function if user click on ok button of java script confirm box in .net
hi, i have one problem that is i'm adding the new user to database, if that user is already exist in the database one pop up should display with message like 'user already exists are u sure you want to update the role of the user' with 'yes' and 'no ' buttons on pop up, if user click on 'yes' button then it should call edituser() method of c3.net other wise it should reset the selected controls. how to do this using extenal .js file with javascript confirm box   Hi When user click on "Yes" set a asp.net hidden field value to be "t...

Getting an "Invalid postback or callback argument" on a button postback (this was working)
Hello, I recently made a few modifications to one of my client's layout and now the email form isn't working (http://capitalcitycycles.net/contact.aspx). I really can't figure this out and I've googled it to death only to find a few forms with people having the same problem with no resolution.. any help would be greatly appreciated! contact.aspx:  <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Contact.aspx.cs" Inherits="Contact" Title="Contact Capital Ci...

executing server side code and client side (javascript) code simultaneously while clicking a button
how to execute server side code and client side (javascript) code simultaneously while clicking a button in asp.net. You can't. When clicking a button: the client-side executes, the page does a PostBack, then the server-side executes.NC... what if i want to update a database and then open a new windows is it possible with Jscript.net?...

Invalid postback or callback argument.
I am using master Page which has login txtboxes allows user to login and in child page has datagrid and link button inside the update panel. When the link button clicked from the business object the data are populated to grid. for example from page1-->page2 (Has grid,updatepanel)-->page3(dispay controls) Scenario User goes to page1-->page2-->In page2 user click linkbuton and results displays in GRID and then user logs in to the system in the TOP of trhe page, then user moves to ->Page3 by clicking button and from there user press BACK button come to PAGE2 then...

Invalid Postback or callback argument
I'm trying to get images (just the path) from DB and then show it into the gridView as button: I'm using Ajax and when I click the image it shows me a error message: The problem occurs just when I'm using Masterpages. ======================================================================================== <%@ Page Language="C#" EnableEventValidation="true" MasterPageFile="~/default.master" AutoEventWireup="true" CodeFile="teste.aspx.cs" Inherits="TEMP_teste" Title="Untitled Page" %> <...

Invalid postback or callback argument
I have added a couple of buttons to my ASP.NET 2.0 page. which both aremeant to do pretty simple things, a Back button and a Submit databutton. But I get this error whenever I click either of the buttons :Invalid postback or callback argument. Event validation is enabledusing <pages enableEventValidation="true"/> in configuration or <%@ PageEnableEventValidation="true" %> in a page. For security purposes, thisfeature verifies that arguments to postback or callback events originatefrom the server control that originally rendered them. If the data isvalid and expected, use theClien...

Invalid postback or callback argument.
 Invalid postback or callback argument. Event validation is enabled using "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.Specs:-- VS 2005 C#-- Windows XP ProHere's what I'm trying to do:Use pure Ajax to call a web service to pop...

Web resources about - System.ArgumentException: Invalid postback or callback argument - When clicking OK or Cancel on JavaScript Confirmation box - asp.net.client-side

Resources last updated: 12/30/2015 9:23:52 PM