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

x
?
Solved

How to combine Javascript with ASP.Net

Posted on 2006-06-28
1
Medium Priority
?
492 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 750 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

Technology Partners: 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

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…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…
Suggested Courses

877 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