Solved

How to combine Javascript with ASP.Net

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

744 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

11 Experts available now in Live!

Get 1:1 Help Now