Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

asp.net 4 to javascript

Posted on 2011-03-04
2
Medium Priority
?
284 Views
Last Modified: 2012-05-11
How do you read in a value from a asp.net text box in javascript.  I am not using a form.
var dateValue = new Date();
dateValue = this.document.getElementById("txtDate1").value;
reading it from this text box.
<asp:TextBox
     ID="txtDate1"
     runat="server"/>
I get this error when I run it
Microsoft JScript runtime error: Object required
0
Comment
Question by:Galagos1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
Rahul Agarwal earned 500 total points
ID: 35041559
Instead of this.document.getElementById("txtDate1").value; use document.getElementById('<%=Test.ClientID%>').value;
0
 
LVL 7

Expert Comment

by:dxdinh
ID: 35041780
I think, agarwalrahul meant to use

dateValue = document.getElementById('<%=txtDate1.ClientID%>').value
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

660 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