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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Validation problem in custom control

Validation problem in custom control

Scheduled Pinned Locked Moved ASP.NET
helpquestion
6 Posts 3 Posters 1 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.
  • A Offline
    A Offline
    ake_krakbar
    wrote on last edited by
    #1

    Hello folks! I have developed a custom control (upload components, kinda) wich is using a validation component to validate user input. The custom control consists of an upload field, a validation control & a submit button + various logic. If I use one control per aspx there is no problem, but when I use two upload components in one page, sh*t hits the fan. The problem is that when the user fills in data in the first control and push the ok button, validation is triggered - even in the second control. How do I permit the controls from validating each other. If I set the CausesValidation property to false there won´t be any validation at all, and that´s bad...

    T A 2 Replies Last reply
    0
    • A ake_krakbar

      Hello folks! I have developed a custom control (upload components, kinda) wich is using a validation component to validate user input. The custom control consists of an upload field, a validation control & a submit button + various logic. If I use one control per aspx there is no problem, but when I use two upload components in one page, sh*t hits the fan. The problem is that when the user fills in data in the first control and push the ok button, validation is triggered - even in the second control. How do I permit the controls from validating each other. If I set the CausesValidation property to false there won´t be any validation at all, and that´s bad...

      T Offline
      T Offline
      thomasa
      wrote on last edited by
      #2

      You could seperate them by getting the ID from each control, and only validating the control if the ID is coresponding to the button you pushed Hope it helps Thomas

      A 1 Reply Last reply
      0
      • T thomasa

        You could seperate them by getting the ID from each control, and only validating the control if the ID is coresponding to the button you pushed Hope it helps Thomas

        A Offline
        A Offline
        ake_krakbar
        wrote on last edited by
        #3

        Hello Thomas! Would I have to perform this test inside the aspx that is using the controls or could I do it inside the control (would be better). The problem is that the buttons triggering the events have the same ID (becuase they are just to instances of the same custom control). I´m not quite following you. Could you please fill me in?

        1 Reply Last reply
        0
        • A ake_krakbar

          Hello folks! I have developed a custom control (upload components, kinda) wich is using a validation component to validate user input. The custom control consists of an upload field, a validation control & a submit button + various logic. If I use one control per aspx there is no problem, but when I use two upload components in one page, sh*t hits the fan. The problem is that when the user fills in data in the first control and push the ok button, validation is triggered - even in the second control. How do I permit the controls from validating each other. If I set the CausesValidation property to false there won´t be any validation at all, and that´s bad...

          A Offline
          A Offline
          Andy Brummer
          wrote on last edited by
          #4

          Make sure your control derives from INammingContainer this will give unique ids to your child controls.

          A 1 Reply Last reply
          0
          • A Andy Brummer

            Make sure your control derives from INammingContainer this will give unique ids to your child controls.

            A Offline
            A Offline
            ake_krakbar
            wrote on last edited by
            #5

            yeah thats true. Forgot about that! :-> But still, this check can´t be performed inside the custom controls, right?

            A 1 Reply Last reply
            0
            • A ake_krakbar

              yeah thats true. Forgot about that! :-> But still, this check can´t be performed inside the custom controls, right?

              A Offline
              A Offline
              Andy Brummer
              wrote on last edited by
              #6

              You should be able to get the conrols operating completely independently on the page.


              I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

              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