Solved

How to combine Javascript with ASP.Net

Posted on 2006-06-28
1
479 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

932 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

9 Experts available now in Live!

Get 1:1 Help Now