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. How to validate the textbox

How to validate the textbox

Scheduled Pinned Locked Moved ASP.NET
helptutorial
4 Posts 4 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.
  • A Offline
    A Offline
    Anjani Poornima
    wrote on last edited by
    #1

    Hello, I am having two textboxe's i.e Credit and Debit. I want to validate the textbox so that only must be entered i.e either credit or debit. If the both the textboxe's are filled it must raise a validation that only must be filled. plz help me how to validate these textboxe's Thanks in advance :)

    S 1 Reply Last reply
    0
    • A Anjani Poornima

      Hello, I am having two textboxe's i.e Credit and Debit. I want to validate the textbox so that only must be entered i.e either credit or debit. If the both the textboxe's are filled it must raise a validation that only must be filled. plz help me how to validate these textboxe's Thanks in advance :)

      S Offline
      S Offline
      sekannak
      wrote on last edited by
      #2

      Hi, u can do from client side, function fnnotnull() { if ((document.GetelementId("<%= txtCredit.ClientID %>").value <> "") && (document.GetelementId("<%= txtdebit.ClientID %>").value <> "")) { alert("Msg here"); return false; } } u can call this in a button onclientclick event regards, kannak....

      kannak

      A D 2 Replies Last reply
      0
      • S sekannak

        Hi, u can do from client side, function fnnotnull() { if ((document.GetelementId("<%= txtCredit.ClientID %>").value <> "") && (document.GetelementId("<%= txtdebit.ClientID %>").value <> "")) { alert("Msg here"); return false; } } u can call this in a button onclientclick event regards, kannak....

        kannak

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

        I guess, you directly write the code over here :) Small Correction,

        sekannak wrote:

        GetelementId(

        getElementById :)

        cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net My Latest Article : IIS Remote Debugging

        1 Reply Last reply
        0
        • S sekannak

          Hi, u can do from client side, function fnnotnull() { if ((document.GetelementId("<%= txtCredit.ClientID %>").value <> "") && (document.GetelementId("<%= txtdebit.ClientID %>").value <> "")) { alert("Msg here"); return false; } } u can call this in a button onclientclick event regards, kannak....

          kannak

          D Offline
          D Offline
          DoctorMick
          wrote on last edited by
          #4

          As an improvement to this, you may want to wrap this javascript into a custom validator and include server side validation also.

          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