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. Pass textbox value to javascript function

Pass textbox value to javascript function

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-net
5 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.
  • H Offline
    H Offline
    Hemant Thaker
    wrote on last edited by
    #1

    Hi.. I am using asp.net/c#. could u tell me how would i pass textbox value to javascript function, I have one button and a textbox in my aspx file and if user clicks this button, i want textbox value to pass in javascript function. Now my javascript function returns boolean value true/false , and how would i retrieve this return value , as I want to show messages accordingly. thanks

    By: Hemant Thaker

    C S 2 Replies Last reply
    0
    • H Hemant Thaker

      Hi.. I am using asp.net/c#. could u tell me how would i pass textbox value to javascript function, I have one button and a textbox in my aspx file and if user clicks this button, i want textbox value to pass in javascript function. Now my javascript function returns boolean value true/false , and how would i retrieve this return value , as I want to show messages accordingly. thanks

      By: Hemant Thaker

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Passing the textbox is easy - you use document.getElementById to get a reference. The ClientID property on the server side will give you the param you need for that. If you want to 'show messages', your best bet is to make controls visible in the same js, or show a confirm or alert message in your js

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      H 1 Reply Last reply
      0
      • H Hemant Thaker

        Hi.. I am using asp.net/c#. could u tell me how would i pass textbox value to javascript function, I have one button and a textbox in my aspx file and if user clicks this button, i want textbox value to pass in javascript function. Now my javascript function returns boolean value true/false , and how would i retrieve this return value , as I want to show messages accordingly. thanks

        By: Hemant Thaker

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

        there is some way to get the text box value ;) one is to use .ClientId in your asp code like this : document.getElementById(<% textbox1.ClientId %>).value or if did`nt help you can do something else :) the ClientIds always the same as each other , so you can find the ID by view source of the page ! :laugh: for example it will be like this :

        document.getElemetById('ctl00_ContentPlaceHolder1_textBox1').value

        :cool:

        H 1 Reply Last reply
        0
        • C Christian Graus

          Passing the textbox is easy - you use document.getElementById to get a reference. The ClientID property on the server side will give you the param you need for that. If you want to 'show messages', your best bet is to make controls visible in the same js, or show a confirm or alert message in your js

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          H Offline
          H Offline
          Hemant Thaker
          wrote on last edited by
          #4

          Hi.. I am using vs 2005 and can u guide me How would I debug my javascript function... thanks

          By: Hemant Thaker

          1 Reply Last reply
          0
          • S sajjy

            there is some way to get the text box value ;) one is to use .ClientId in your asp code like this : document.getElementById(<% textbox1.ClientId %>).value or if did`nt help you can do something else :) the ClientIds always the same as each other , so you can find the ID by view source of the page ! :laugh: for example it will be like this :

            document.getElemetById('ctl00_ContentPlaceHolder1_textBox1').value

            :cool:

            H Offline
            H Offline
            Hemant Thaker
            wrote on last edited by
            #5

            Hiii.. I am using vs 2005 and can u guide me How would I debug my javascript function... thanks

            By: Hemant Thaker

            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