hi friends,

           I have a problem


           Requirement

            * Weekends should be disabled.
            * Disable past days
            * specific date should be disabled

So I used jqueery datepicker

Registerdate is ID of the textbox

<tr>
                <td>
                    <asp:Label ID="Label7" runat="server" Text="Register date : " Font-Bold="True">   
                    </asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="Registerdate" runat="server" Width="150px"></asp:TextBox>
                </td>
 </tr>

so added these in head section

<head runat="server">

    <title>.:: Library Management System :: College of Arts, Media and Technology ::.</title>
    <link rel="stylesheet" href="css/Master.css" type="text/css" />
    <link type="text/css" href="menu.css" rel="stylesheet" />
    <!--<script type="text/javascript" src="js/jquery.js"></script>-->
    <!--<script type="text/javascript" src="js/infomanagemenu.js"></script> -->
     <script src="datepicker/jquery-1.4.2.min.js" type="text/javascript"></script>
    <link href="datepicker/jquery-ui-1.8.2.custom.css" rel="stylesheet" type="text/css" />
    <script src="datepicker/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>

<script type="text/javascript">
$(function() {
$("#datepicker").datepicker({ beforeShowDay: $.datepicker.noWeekends });
});

$(function() {

var date = new Date();
var currentMonth = date.getMonth();
var currentDate = date.getDate();
var currentYear = date.getFullYear();
$('#Registerdate').datepicker({
minDate: new Date(currentYear, currentMonth, currentDate) 

});

});

</script>

<script type="text/javascript">
$(function() {
$("#Expiredate").datepicker({ beforeShowDay: $.datepicker.noWeekends });
});
</script>

</head>

if I use both function thats not working properly. only one section is working.

Let me know is there any solution for this problem???

Member Avatar for LastMitch

if I use both function thats not working properly. only one section is working.

Why do you have this twice in one page:

<script type="text/javascript">
$(function() {
$("#Expiredate").datepicker({ beforeShowDay: $.datepicker.noWeekends });
});
</script>

Try this (it's not tested) :

<script type="text/javascript">
$(document).ready(function(){
$("input[id$=Registerdate]").datepicker();
}); 
</script>

<asp:textbox id="Registerdate" runat="server" cssclass="date-picker" />< /asp:TextBox>

Read this because since you are in ASP.net section, your javascript code doesn't work well with ASP.net:

http://blogs.msdn.com/b/stuartleeks/archive/2011/01/25/asp-net-mvc-3-integrating-with-the-jquery-ui-date-picker-and-adding-a-jquery-validate-date-range-validator.aspx

I don't see any ASP.net code that will change the date with javascript that's why I provide the link to see how to change date.

Do you have a small code snippet of ASP.net that is related to datepicker?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.