Invalid postback or callback argument in .NET App

I was working on this Sharepoint app, and I needed to create a user control that allowed file uploads and database updates for an image area of the site with specific requirements.

It is a pretty basic setup, load all the images on page load, and use a modal with an edit screen that is populated on post back of clicking an edit button.

I kept getting and Invalid postback or callback argurment when clicking edit, but not on page load.  Turns out, I was databinding a datagrid in the page load function, but I was trying to rebind it on post back, which wasn’t needed and probably a bad idea.  By simply putting my databind function inside a check to make sure it wasn’t a post back, the problem was solved.

Moral of the story, when copying another control that is ugly, and cleaning it up for your own use, make sure you pay attention to all the lines of code you are deleting and what they do.  I removed 300 lines that needed to go, and two that should have stayed.

Leave a Reply

Your email address will not be published. Required fields are marked *