Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Assign a Java Script Variable to ASP.Net Texbox

Posted on 2011-09-23
7
Medium Priority
?
217 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 750 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 375 total points
ID: 36593891
if your familiar with query, you can use the following:

var variableName = $("#textbox1").val();
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 10

Assisted Solution

by:Chad Smith
Chad Smith earned 750 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 375 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Integration Management Part 2
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

886 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