Solved

How to combine Javascript with ASP.Net

Posted on 2006-06-28
1
482 Views
Last Modified: 2008-02-26
I want to call the following in  a ASP.net form, but it gives me error.

<input type="text" value="2004/02/02" readonly name="theDate">
<input type="button" value="Cal" onclick="displayCalendar(document.forms[0].theDate,'yyyy/mm/dd',this)">


I also tried to modifiy the above code to the following, but still doesnt work.
<asp:TextBox Runat=server ID="theDate" ></asp:TextBox>
            <asp:Button id="tt" Runat=server Text="Cal"></asp:Button>
in C# code,       

      private void Page_Load(object sender, System.EventArgs e)
      {
      tt.Attributes.Add("onclick","displayCalendar(document.getElementById('theDate').value,'yyyy/mm/dd',this);");

....

}
0
Comment
Question by:yk99
1 Comment
 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 250 total points
ID: 17002113
input type="text" value="2004/02/02" readonly name="theDate">
<input type="button" value="Cal" onclick="displayCalendar(document.forms[0].theDate,'yyyy/mm/dd',this);"> --put semicolen after )

<asp:TextBox Runat=server ID="theDate" ></asp:TextBox>
          <asp:Button id="tt" Runat=server Text="Cal"></asp:Button>
in C# code,      

     private void Page_Load(object sender, System.EventArgs e)
     {
     tt.Attributes.Add("onclick()","displayCalendar(document.getElementById('theDate').value,'yyyy/mm/dd',this);");

....

}
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

776 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