Saturday, March 24, 2012

Invalid postback or callback argument on page back

Hello,

I ran into this by placing myselft as the final user of my web application.

I have several pages using AJAX controls (update panel, autocomplete extender, etc), and I noticed that when I have redirect to another page, and till there, using the IE back page button, the previous page is loaded and then a message error is prompt (Invalid postback or callback argument)

By now I'm disabling the - PageEventValidation - but, actually I'd like to solve it in a better way.

Thanks in advance guys,

Hi Manotas,

Do you have databound controls, like a DropDownList or a GridView? If so, did you make sure they are initialized in a block that checks for inital page load?

For example:

if (false == Page.IsPostBack)

{

// code for initial load goes here

}

else

{

// code for PostBack from same page goes here

}

Pete


Hi Peter,

Thanks for reply.
I do have bound control. After reading at your post, I checked the initialization of my databound controls.
I realized that there is a gridview which I am initializing at first loading but not during postbacks, however, when the page is reload by using the back button on the browser, there is a postback and maybe is there where is my error. The thing is that I'm not sure what kind of validation I could do there since I wouldn't like to change the data of the parameters used on the select's datasource ...

I tried to find a pattern on the error... I must correct what I said about the invalid postback after the page's loading. In fact, I realized that it was happening only sometimes, and only when I was clicking on certain linkbuttons, on the other side, if I click on others buttons I was not having any problem at all. Also, as you mentioned the fact of look at databoud controls, I began testing and I found that I was getting the error only when I was turning back to the page and my gridview was visible (I'm using a multiview control, and the gridview I mentioned above is contained in its view).

By now, I restored the PageEventValidation and added at the update panel a postback trigger for the controls which are making visible my gridview.

Since I'm not receving the error message anymore... let's see I'l heard about it later...

Cheers

No comments:

Post a Comment