Solved

Assign a Java Script Variable to ASP.Net Texbox

Posted on 2011-09-23
7
206 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

864 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now