0


i have an asp.net Calendar control that need to behave like an ajax control (when i press the title it switches states : days , months years). - i have this working fine. the problem is when i switch back to to asp calendar i need to perform a post back with the new date calculated. when doing so i'm getting this error : Invalid postback or callback argument. Event validation is enabled using 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.
when i set EnableEventValidation to False everything i working as expected.
The control validate the postback arrgument for the date and fail if it is more than month back or month forward.
I need to keep using the asp control
I would like to stay out of code behind and keep EnableEventValidation=True
Any ideas ?

UPDATE
when i select a date within -+ month i have no error. only when the date was not in some kind of inner range validator (smaller or bigger than one month from current date)

Simple Steps to reproduce problem :
1. Add asp.net Calendar control to a page. 2. browse to it and open debugging console. 3. copy one day post back script : __doPostBack('ctl00$cphToolbar$cldEventDate','8163') and run it with bigger number (calculated from 1/1/200 i think - just add 2000 or so)
4. you will get error (as long as EnableEventValidation="true")
5. run the original script with 10 added to the number and you will not get the error

gilad
  • 297
  • 5
  • 21
  • do you have code on page_load event ? – Manoj Purohit Feb 25 '14 at 13:04
  • yes i have. some of it inside a !ispostback block and some not. do you think this is the problem ? no way to work around it ? – gilad Feb 25 '14 at 13:06
  • refer this http://stackoverflow.com/questions/228969/invalid-postback-or-callback-argument-event-validation-is-enabled-using-page – Manoj Purohit Feb 25 '14 at 13:07
  • yhe i read it already but is not the case for me. i test it with plain control with no code behind at all and from the debugger console i have fired the javascript : __doPostBack('ctl00$MainContent$clnd','8173') and got the error . it is a control validation . if i'll fire this line with a permitted date the error will not raise – gilad Feb 25 '14 at 13:15

0 Answers0