Click here to Skip to main content
15,889,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to disable the dates other than monday into calendarextender C#

What I have tried:

C#
<cc1:CalendarExtender ID="txtthu2_CalendarExtender" Format="dd/MM/yyyy" runat="server" TargetControlID="txtthu2" FirstDayOfWeek="Monday"  TodaysDateFormat="dd/MM/yyyy" >
</cc1:CalendarExtender>
Posted
Updated 16-Nov-17 6:30am
v2

1 solution

try
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="MvcApplication2.WebForm1" %>
 

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script>
        function DisableExceptMonday(sender,args) {
            for (var i = 0; i < 6; i++) {
                var row = sender._days.children[0].childNodes[1].children[i];
                for (var j = 0; j < 7; j++) {
                    var cell = row.children[j].firstChild;

                    if (cell.id != sender._id + "_day_" + i + "_" + "0") {
                        console.log(cell.id)
                         
                        cell.parentElement.className = 'ajax__calendar_invalid'
                    } 
                }
            }
        }
    </script>
</head>
<body>
  
   <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
      
             <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <ajaxToolkit:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" 
           
            Enabled="True" TargetControlID="TextBox1" FirstDayOfWeek="Monday" OnClientShown="DisableExceptMonday">
        </ajaxToolkit:CalendarExtender>     
  
    
    </form>
</body>
</html>
 
Share this answer
 

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