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. Extending the Textbox Control in ASP.Net using C#

Extending the Textbox Control in ASP.Net using C#

Scheduled Pinned Locked Moved ASP.NET
7 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.
  • N Offline
    N Offline
    Neeraj Kr
    wrote on last edited by
    #1

    Hi, I want to create a custom textbox control in ASP.Net using C#, which extends the properties of the normal textbox control and it only allows numeric, alphabetic and alphanumeric characters depending upon the users choice. It should have a built-in client side validation for the same. Also, it should have a property called required, which when set to true, the text box also shows the property of the required field validator.

    -----Have A Nice Day-----

    C N 2 Replies Last reply
    0
    • N Neeraj Kr

      Hi, I want to create a custom textbox control in ASP.Net using C#, which extends the properties of the normal textbox control and it only allows numeric, alphabetic and alphanumeric characters depending upon the users choice. It should have a built-in client side validation for the same. Also, it should have a property called required, which when set to true, the text box also shows the property of the required field validator.

      -----Have A Nice Day-----

      C Offline
      C Offline
      ca8msm
      wrote on last edited by
      #2

      What have you done so far? Anything?

      Mark, http://aspnetlibrary.com

      N 1 Reply Last reply
      0
      • C ca8msm

        What have you done so far? Anything?

        Mark, http://aspnetlibrary.com

        N Offline
        N Offline
        Neeraj Kr
        wrote on last edited by
        #3

        Yes, I tried and found out that I would need to override the OnKeyPress method to track the keys and show the messages correspondingly, but, this OnKeyPress method is for Windows forms and I want it for Web.

        -----Have A Nice Day-----

        C 1 Reply Last reply
        0
        • N Neeraj Kr

          Yes, I tried and found out that I would need to override the OnKeyPress method to track the keys and show the messages correspondingly, but, this OnKeyPress method is for Windows forms and I want it for Web.

          -----Have A Nice Day-----

          C Offline
          C Offline
          ca8msm
          wrote on last edited by
          #4

          JavaScript also has an onkeypress method that you can use for the client side validation.

          Mark, http://aspnetlibrary.com

          N 1 Reply Last reply
          0
          • C ca8msm

            JavaScript also has an onkeypress method that you can use for the client side validation.

            Mark, http://aspnetlibrary.com

            N Offline
            N Offline
            Neeraj Kr
            wrote on last edited by
            #5

            I want the textbox to do everything as a custom control, so that whenever the textbox is used in any form in any project, no code needs to be written anywhere for it.

            -----Have A Nice Day-----

            C 1 Reply Last reply
            0
            • N Neeraj Kr

              I want the textbox to do everything as a custom control, so that whenever the textbox is used in any form in any project, no code needs to be written anywhere for it.

              -----Have A Nice Day-----

              C Offline
              C Offline
              ca8msm
              wrote on last edited by
              #6

              It will if you extend the control as it will inherit all of it's properties and methods.

              Mark, http://aspnetlibrary.com

              1 Reply Last reply
              0
              • N Neeraj Kr

                Hi, I want to create a custom textbox control in ASP.Net using C#, which extends the properties of the normal textbox control and it only allows numeric, alphabetic and alphanumeric characters depending upon the users choice. It should have a built-in client side validation for the same. Also, it should have a property called required, which when set to true, the text box also shows the property of the required field validator.

                -----Have A Nice Day-----

                N Offline
                N Offline
                N a v a n e e t h
                wrote on last edited by
                #7

                I think in web you can't handle keypress event on server without a postback


                string Cheers = "Navaneeth!!" www.w3hearts.com

                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