How do we make the date to appear in the textbox on the click of an image button using jquery and ASP.NET?
-
find the clientid of that server control and jQuery("#clientid").datepicker(); set properties you need of datepicker...Vishal Sharma– Vishal Sharma2013-03-26 05:34:28 +00:00Commented Mar 26, 2013 at 5:34
-
checkout jqueryuiArun P Johny– Arun P Johny2013-03-26 05:34:35 +00:00Commented Mar 26, 2013 at 5:34
-
3no research no try just posted here so poor question .rahularyansharma– rahularyansharma2013-03-26 05:40:36 +00:00Commented Mar 26, 2013 at 5:40
Add a comment
|
3 Answers
Here is a good example which may help you to use it.
http://www.codeproject.com/Articles/47474/ASP-NET-Control-from-jQuery-DatePicker-in-3-Minute
Edit 1
You should check out the jQuery UI DatePicker.
ASP.NET Example
<script>
$(function() {
$( "#<%= txtDate.ClientID %>" ).datepicker();
});
</script>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtDate" runat="server" />
</div>
</form>
Edit 2
If you want to show button
Go through this linke
How I can use JQuery Datepicker with a Icon and a Format in ASP.NET
Which suggest you to use like
$(".txtVon").datepicker({
showOn: "button",
buttonImage: "images/calendar.gif",
buttonImageOnly: true
});
Comments
Please try like below code with class selector, know to more detail click on jQuery Date Picker
<asp:TextBox ID="txtFromDate" CssClass="From-Date" runat="server"></asp:TextBox>
<script language="javascript" type="text/javascript">
jQuery('.From-Date').datepicker({
showOn: "button",
buttonText: "Select Date",
buttonImage: "images/calendar.png",
buttonImageOnly: true
}
});
</script>
Comments
Try this:
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$("#<%= txtDate.ClientID %>").datepicker({
showOn: "button",
buttonImage: generateURL("/Images/Calendar.jpg"),
buttonImageOnly: true
});
});
</script>
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>