Tuesday, June 29, 2010

How to disable weekends of asp.net calender - Asp.net

We can use following properties to disable days of the asp.net calender.
  • e.Cell.Enabled
  • e.Day.IsSelectable
  • e.Cell.BackColor
Example
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script runat="server">
        protected void DayRander(object sender, DayRenderEventArgs e)
        {
            if(e.Day.IsWeekend)
            {
                e.Cell.Enabled = false;
                e.Day.IsSelectable = false;
                e.Cell.BackColor = Color.Gray;
            }
        }        
    </script>
</head>
<body>
    <form id="form1" runat="server">
 
    <div>
        <asp:Calendar runat="server" ID="calDates" OnDayRender="DayRander" />
    </div>
    </form>
</body>
</html>

No comments:

Azure Storage Account Types

Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...