Problem with post back validation
-
I'm having quite the bizzare issue. I created a page a while ago which validates my form using javascript and if everything looks good, then it issues a post back passing the 'submit_button' as the posting control and 'validated' as the argument. This works just fine, however I copied the page to a new form and made some slight modifications to the javascript, images, and layout on the page, however both pages are using the same "validate_form" function but the new page that I copied over always throws the "invalid post back or callback argument". I've scoured the net for the better part of this day and have come across the clientscript.RegisterForEventValidation method but cannot seem to get that to work. But...again what is bizzare is why it's not giving me this error on the first page I made months ago as there's no code disabling the validation for the page. I've tried this so far, but still get the error:
protected override void Render(HtmlTextWriter writer)
{
this.ClientScript.RegisterForEventValidation("submit_button", "validated");base.Render(writer); }
What's also weird is when I debug on the Page_Init event, I can look at the live "Validators" collection but even after the RegisterForEventValidation() executes, I still get a collection count of zero. Am I looking in the wrong place? Thanks!
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.
-
I'm having quite the bizzare issue. I created a page a while ago which validates my form using javascript and if everything looks good, then it issues a post back passing the 'submit_button' as the posting control and 'validated' as the argument. This works just fine, however I copied the page to a new form and made some slight modifications to the javascript, images, and layout on the page, however both pages are using the same "validate_form" function but the new page that I copied over always throws the "invalid post back or callback argument". I've scoured the net for the better part of this day and have come across the clientscript.RegisterForEventValidation method but cannot seem to get that to work. But...again what is bizzare is why it's not giving me this error on the first page I made months ago as there's no code disabling the validation for the page. I've tried this so far, but still get the error:
protected override void Render(HtmlTextWriter writer)
{
this.ClientScript.RegisterForEventValidation("submit_button", "validated");base.Render(writer); }
What's also weird is when I debug on the Page_Init event, I can look at the live "Validators" collection but even after the RegisterForEventValidation() executes, I still get a collection count of zero. Am I looking in the wrong place? Thanks!
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.
Ah, after looking at this http://forums.asp.net/t/945348.aspx I did find that it's a drop down list control causing the error. The control appears to be alright, but because I'm adding option values using javascript that's what's causing the invalid argument error. I'm still curious if there's a way using the debugger I could have found out which "argument" or control post back was causing the error quicker. Anyone have any suggestions? Thanks!
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.