Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem with post back validation

Problem with post back validation

Scheduled Pinned Locked Moved ASP.NET
helpquestionjavascriptdebugging
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    compninja25
    wrote on last edited by
    #1

    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.

    C 1 Reply Last reply
    0
    • C compninja25

      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.

      C Offline
      C Offline
      compninja25
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups