javascript - Asp.Net Date Picker Control from the Text Box -
i have 2 text box accepting date calender control. 1 & to. take date accordingly follows.
on 1st text box(from),it can take today & other previous date. but, 2nd text box(to),it takes today date & should take date not less date taken on 1st text box.
how can in .net. code.
<%@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="default" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org /tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <title>jquery ui datepicker - default functionality</title> <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.19.custom.css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js"></script> <script type="text/javascript"> $(function() { $("#txtfrom").datepicker({ maxdate:0 }); }); </script> <script type="text/javascript"> $(function () { $("#txtto").datepicker({}); }); </script> <style type="text/css"> .ui-datepicker { font-size:8pt !important} </style> </head> <body> <form id="form1" runat="server"> <div class="demo"> <b>from:</b> <asp:textbox id="txtfrom" runat="server" />     <b>to:</b><asp:textbox id="txtto" runat="server"></asp:textbox> </div> </form> </body> </html>
my first text box working properly.but can on codeing of 2nd text box.
set datepickers this:
$("#txtfrom").datepicker({ onselect: function (selecteddate) { $("#txtto").datepicker("option", "mindate", selecteddate); } }); $("#txtto").datepicker({ onselect: function (selecteddate) { $("#txtfrom").datepicker("option", "maxdate", selecteddate); } });
what doing change option
mindate
, maxdate
txtfrom , txtto respectively, when date selected in datepicker.
Comments
Post a Comment