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. Validation Controls

Validation Controls

Scheduled Pinned Locked Moved ASP.NET
help
4 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.
  • Y Offline
    Y Offline
    yaminilatha
    wrote on last edited by
    #1

    Hi, This is the situation...Now i have 2 requiredfield validators for 2 texboxes, one save button and one cancel button. When i click save button the 2 validators must be raised. When i click the cancel only one validator for one textbox should be raised. Plz help me, how is this possible.... thanx, yamini

    S R 2 Replies Last reply
    0
    • Y yaminilatha

      Hi, This is the situation...Now i have 2 requiredfield validators for 2 texboxes, one save button and one cancel button. When i click save button the 2 validators must be raised. When i click the cancel only one validator for one textbox should be raised. Plz help me, how is this possible.... thanx, yamini

      S Offline
      S Offline
      Shahzad Aslam
      wrote on last edited by
      #2

      For this u have to create 3 validators. Apply 2 validators for save button and 1 validator for cancel button. Check the Validation Group property in Save button and its validators, Apply the same name for both. Apply the different Validation Group name for cancel button. Shahzad Aslam Software Engineer

      Y 1 Reply Last reply
      0
      • Y yaminilatha

        Hi, This is the situation...Now i have 2 requiredfield validators for 2 texboxes, one save button and one cancel button. When i click save button the 2 validators must be raised. When i click the cancel only one validator for one textbox should be raised. Plz help me, how is this possible.... thanx, yamini

        R Offline
        R Offline
        rujuc
        wrote on last edited by
        #3

        Validation group will solve your problem ...check out this .. <asp:TextBox ID="TextBox1" Runat="server" ValidationGroup="First"></asp:TextBox> <asp:TextBox ID="TextBox2" Runat="server" ValidationGroup="First"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat="server" ValidationGroup="First" ErrorMessage="TextBox1 should not be blank" ControlToValidate="TextBox1"> </asp:RequiredFieldValidator> <asp:Button ID="Submit1" Runat="server" ValidationGroup="First" Text="Submit 1" />

        <asp:TextBox ID="TextBox3" Runat="server" ValidationGroup="Second"></asp:TextBox> <asp:TextBox ID="TextBox4" Runat="server" ValidationGroup="Second"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Runat="server" ErrorMessage=" TextBox3 should not be blank" ControlToValidate="TextBox3" ValidationGroup="Second"> </asp:RequiredFieldValidator> <asp:Button ID="Submit2" Runat="server" ValidationGroup="Second" Text="Submit 2" />

        1 Reply Last reply
        0
        • S Shahzad Aslam

          For this u have to create 3 validators. Apply 2 validators for save button and 1 validator for cancel button. Check the Validation Group property in Save button and its validators, Apply the same name for both. Apply the different Validation Group name for cancel button. Shahzad Aslam Software Engineer

          Y Offline
          Y Offline
          yaminilatha
          wrote on last edited by
          #4

          thanx its working

          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