Solved

Assign a Java Script Variable to ASP.Net Texbox

Posted on 2011-09-23
7
208 Views
Last Modified: 2012-05-12
How can I declare a variable in Java Script that is linked to ASP.Net Textbox.

For example

 var VariableName = textbox1.text ??

Thanks,
Jeff
0
Comment
Question by:jeffreyjseaman
7 Comments
 
LVL 10

Accepted Solution

by:
Chad Smith earned 250 total points
ID: 36590856
var variable = document.getElementById("V_DLEAVE").value
0
 

Author Comment

by:jeffreyjseaman
ID: 36592583
What is V_DLEAVE ?
0
 
LVL 14

Assisted Solution

by:binaryevo
binaryevo earned 125 total points
ID: 36593891
if your familiar with query, you can use the following:

var variableName = $("#textbox1").val();
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 10

Assisted Solution

by:Chad Smith
Chad Smith earned 250 total points
ID: 36593966
Sorry V_DLEAVE should be replaced by the ID of your textbox
0
 
LVL 17

Assisted Solution

by:sonawanekiran
sonawanekiran earned 125 total points
ID: 36595111
Use jquery. U have more adv over javascript. U can assign value to javascript variable in couple of ways:
1) var ur_var=$("#<%=textbox1.ClientID%>").val();

OR

2) assign class to textbox e.g. CssClass="txtclass" & ten use below jquery


var ur_var=$(".txtclass").val();
0
 

Author Comment

by:jeffreyjseaman
ID: 36595276
Ok thanks i will try that. I would prefer Jquery
0
 

Author Closing Comment

by:jeffreyjseaman
ID: 37250862
partilly worked
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question