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. Conditional Validation in DataGrids

Conditional Validation in DataGrids

Scheduled Pinned Locked Moved ASP.NET
question
3 Posts 2 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.
  • B Offline
    B Offline
    beacon dartmouth
    wrote on last edited by
    #1

    I have an insert row in the footer of a DataGrid. I need to validate user data on each textbox but only when the "Add Button" is clicked, otherwise empty textboxes will flag a warning preventing the user from even moving between pages. I thought of using a custom validator and checking that the add button was clicked to submit the form, but I'm not sure as to the syntax to follow. Has anyone done any of this before?? b-d:|

    J 1 Reply Last reply
    0
    • B beacon dartmouth

      I have an insert row in the footer of a DataGrid. I need to validate user data on each textbox but only when the "Add Button" is clicked, otherwise empty textboxes will flag a warning preventing the user from even moving between pages. I thought of using a custom validator and checking that the add button was clicked to submit the form, but I'm not sure as to the syntax to follow. Has anyone done any of this before?? b-d:|

      J Offline
      J Offline
      Jon G
      wrote on last edited by
      #2

      You can set other buttons on the form (or any control that causes validation) to not validate. For example: MyButton.CausesValidation = false; By doing so, you can leave your AddButton.CausesValidation to TRUE, and it will be the only control on the page to check for validation. Jon G www.Gizmocoder.com

      B 1 Reply Last reply
      0
      • J Jon G

        You can set other buttons on the form (or any control that causes validation) to not validate. For example: MyButton.CausesValidation = false; By doing so, you can leave your AddButton.CausesValidation to TRUE, and it will be the only control on the page to check for validation. Jon G www.Gizmocoder.com

        B Offline
        B Offline
        beacon dartmouth
        wrote on last edited by
        #3

        Jon G. Thanks for the tip. It was so simple that I'm almost embarrased! I was taking the long road in thinking it through when it was simpler to turn off causesValidation on the navigation buttons and voilá! Regards to you, b-d

        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