Pass textbox value to javascript function
-
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
-
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
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.
-
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
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:
-
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.
Hi.. I am using vs 2005 and can u guide me How would I debug my javascript function... thanks
By: Hemant Thaker
-
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:
Hiii.. I am using vs 2005 and can u guide me How would I debug my javascript function... thanks
By: Hemant Thaker