Click here to Skip to main content
15,559,642 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to create a date picker. I figured out it in AJAX.I need to know the other possible ways of doing it in my asp form.Pls someone help me
Posted
Updated 20-Jul-12 2:08am
v2
Comments
Unareshraju 20-Jul-12 7:08am    
may i know your creating custom control of datepicker?

Look here: CP articles on ASP.NET DatePickers[^]

Apart from existing control (or using AJAX), you can use jQuery/Javascript for picking up date form a calendar.
 
Share this answer
 
Try with this code ..............


XML
<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>jQuery Datepicker Demo</title>
    <style type="text/css">
        div.ui-datepicker
        {
            font-size: 10px;
        }
    </style>
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/start/jquery-ui.css" type="text/css" media="all" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#txtDateFrom,#txtDateTo').datepicker({
                changeYear: true,
                beforeShow: function (textbox, instance) {
                instance.dpDiv.css({
                    marginTop: (-textbox.offsetHeight) + 'px',
                    marginLeft: textbox.offsetWidth + 'px'
                });
                }
            });
        });
    </script>
    </head>
    <body>
     <form id="testForm" runat="server">
        <div>
            <input type="text" id="txtDateFrom" /><br />
            <input type="text" id="txtDateTo" />
        </div>
     </form>
    </body>
</html>
 
Share this answer
 
Comments
ajithk444 26-Jul-12 3:17am    
hi sanwar.I need to get time also. any date and time picker using javascript.?
sanwar_mal_jat 26-Jul-12 3:22am    
Hello use this link may be help full......

http://www.javascriptkit.com/script/script2/tengcalendar.shtml

http://www.aspsnippets.com/Articles/DateTimePicker-in-ASP.Net-GridView-using-jQuery-DateTimePicker-Plugin.aspx
ajithk444 26-Jul-12 3:59am    
the code u gave above was clear .I need code like that if possible.
sanwar_mal_jat 26-Jul-12 5:48am    
use this link
http://www.javascriptkit.com/script/script2/timestamp.shtml
and down load datepick.zip (download by right clicking, and selecting "save as") Link in step 3 ,Create a folder and add download file and image in this folder and create a html file and past below mention code...........


<html>
<head><title>jQuery Open Calendar</title>
<link rel="stylesheet" href="ui.all.css" type="text/css" media="screen" />
<script language="JavaScript" src="ts_picker.js">

//Add download js file link

</script>

</head>
<body>

<form name="tstest">
<input type="Text" name="timestamp" value="">
<img src="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp">
</form>

</body>
</html>
ajithk444 27-Jul-12 0:16am    
thanks buddy..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900