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. CustomValidator and Gridview problem

CustomValidator and Gridview problem

Scheduled Pinned Locked Moved ASP.NET
toolshelpquestion
6 Posts 3 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.
  • K Offline
    K Offline
    kensai
    wrote on last edited by
    #1

    I have a customvalidator for textbox' in a gridview. The problem is, it doesn't fire up. I did put a break point to validation method but it never catches. The code is working fine in a single page with a single textbox but not in a GridView Can you please tell me what's wrong? Here's my code: private void NumericControl(object sender, ServerValidateEventArgs args) { if (Tools.IsNumeric(args.Value)) args.IsValid = true; else args.IsValid = false; }

    B E 2 Replies Last reply
    0
    • K kensai

      I have a customvalidator for textbox' in a gridview. The problem is, it doesn't fire up. I did put a break point to validation method but it never catches. The code is working fine in a single page with a single textbox but not in a GridView Can you please tell me what's wrong? Here's my code: private void NumericControl(object sender, ServerValidateEventArgs args) { if (Tools.IsNumeric(args.Value)) args.IsValid = true; else args.IsValid = false; }

      B Offline
      B Offline
      Bardy85
      wrote on last edited by
      #2

      Check if your button has CausesValidation = true and the ValidationGroup = "Kontor"; And Set the ValidationGroup="Kontor" for the TextBox EG

      K 1 Reply Last reply
      0
      • B Bardy85

        Check if your button has CausesValidation = true and the ValidationGroup = "Kontor"; And Set the ValidationGroup="Kontor" for the TextBox EG

        K Offline
        K Offline
        kensai
        wrote on last edited by
        #3

        I did. I added ValidationGroup to textbox and ValidationGroup and CausesValidation to button. Nothing changed. Thanks for the advice though..

        1 Reply Last reply
        0
        • K kensai

          I have a customvalidator for textbox' in a gridview. The problem is, it doesn't fire up. I did put a break point to validation method but it never catches. The code is working fine in a single page with a single textbox but not in a GridView Can you please tell me what's wrong? Here's my code: private void NumericControl(object sender, ServerValidateEventArgs args) { if (Tools.IsNumeric(args.Value)) args.IsValid = true; else args.IsValid = false; }

          E Offline
          E Offline
          eyeseetee
          wrote on last edited by
          #4

          Check these articles out on validating controls in gridview http://www.eggheadcafe.com/software/aspnet/31834970/customvalidator-in-gridvi.aspx http://www.aspdotnetcodes.com/GridView_Dynamic_Validation.aspx

          K 1 Reply Last reply
          0
          • E eyeseetee

            Check these articles out on validating controls in gridview http://www.eggheadcafe.com/software/aspnet/31834970/customvalidator-in-gridvi.aspx http://www.aspdotnetcodes.com/GridView_Dynamic_Validation.aspx

            K Offline
            K Offline
            kensai
            wrote on last edited by
            #5

            Dynamically adding customvalidator during runtime instead of adding in itemtemplate somehow solved my problem. Thanks for the links. http://www.aspdotnetcodes.com/GridView_Dynamic_Validation.aspx[^]

            E 1 Reply Last reply
            0
            • K kensai

              Dynamically adding customvalidator during runtime instead of adding in itemtemplate somehow solved my problem. Thanks for the links. http://www.aspdotnetcodes.com/GridView_Dynamic_Validation.aspx[^]

              E Offline
              E Offline
              eyeseetee
              wrote on last edited by
              #6

              Problem because the gridview is generated at runtime therefore control validate has to.. maybe

              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