views:

503

answers:

2

I have a simple repeater inside of an UpdatePanel that contains a label and two image buttons. The OnClick property is set in the attributes of each button at design time. When I click either of the buttons, I recieve the "Invalid postback or callback argument. Event validation is enabled........". I have done the exact same thing in other web applications but I cant seem to figure out whats going on here.

A: 

My guess is that your content is changing after it is initially rendered by the server. This error is thrown when a value is posted back to the server (like a selected item value, for example) which was not rendered out in the original response, and is therefore not in viewstate.

The easy fix for your situation is to simply turn off event validation in either the web.config or the @page directive.

smercer
A: 

Setting EnableEventValidation="false" is certainly an easy fix but I wouldn't recommend it, particularly not at the web.config level.

If at all possible, use ClientScript.RegisterForEventValidation instead.

This page explains both methods, with examples: http://odetocode.com/Blogs/scott/archive/2006/03/22/asp-net-event-validation-and-invalid-callback-or-postback-argument-again.aspx

Town