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. RequiredFieldValidator

RequiredFieldValidator

Scheduled Pinned Locked Moved ASP.NET
csharpquestion
3 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.
  • P Offline
    P Offline
    ptvce
    wrote on last edited by
    #1

    i want create a RequiredFieldValidator in my form in c#.net programatically . but i dont know where should i write thats code. i write this below codes but where should i put them? protected RequiredFieldValidator validator; validator.ControlToValidate = "TextBox1"; validator.ErrorMessage = "*"; validator.EnableViewState = true; validator.EnableClientScript = true; validator.Display = ValidatorDisplay.Dynamic; validator.EnableTheming = true; validator.Enabled = true; validator.ID = "validator1"; Page.Form.Attributes.Add("validator1", "validator");

    A S 2 Replies Last reply
    0
    • P ptvce

      i want create a RequiredFieldValidator in my form in c#.net programatically . but i dont know where should i write thats code. i write this below codes but where should i put them? protected RequiredFieldValidator validator; validator.ControlToValidate = "TextBox1"; validator.ErrorMessage = "*"; validator.EnableViewState = true; validator.EnableClientScript = true; validator.Display = ValidatorDisplay.Dynamic; validator.EnableTheming = true; validator.Enabled = true; validator.ID = "validator1"; Page.Form.Attributes.Add("validator1", "validator");

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      add it in page_Load()

      Best Regards ----------------- Abhijit Jana "Success is Journey it's not a destination"

      1 Reply Last reply
      0
      • P ptvce

        i want create a RequiredFieldValidator in my form in c#.net programatically . but i dont know where should i write thats code. i write this below codes but where should i put them? protected RequiredFieldValidator validator; validator.ControlToValidate = "TextBox1"; validator.ErrorMessage = "*"; validator.EnableViewState = true; validator.EnableClientScript = true; validator.Display = ValidatorDisplay.Dynamic; validator.EnableTheming = true; validator.Enabled = true; validator.ID = "validator1"; Page.Form.Attributes.Add("validator1", "validator");

        S Offline
        S Offline
        samMaster
        wrote on last edited by
        #3

        add it in page_Init() or do like this: Add this tag near the TextBox1 and set ValidationGroup for TextBox1

        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