Calendar.ShowGridLines Property
Gets or sets a value indicating whether the days on the Calendar control are separated with grid lines.
[Visual Basic] Public Property ShowGridLines As Boolean [C#] public bool ShowGridLines {get; set;} [C++] public: __property bool get_ShowGridLines(); public: __property void set_ShowGridLines(bool); [JScript] public function get ShowGridLines() : Boolean; public function set ShowGridLines(Boolean);
Property Value
true if the days on the Calendar control are separated with grid lines; otherwise, false. The default value is false.
Remarks
Use the ShowGridLines property to specify whether the days on the Calendar control are separated with grid lines.
Example
[Visual Basic, C#, JScript] The following example demonstrates how to use the ShowGridLines property to display the grid lines between days in the Calendar control.
[Visual Basic] <%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> </head> <body> <form runat="server"> <h3>Calendar Example</h3> <asp:Calendar id="calendar1" runat="server" ShowGridLines="True"/> </form> </body> </html> [C#] <%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> </head> <body> <form runat="server"> <h3>Calendar Example</h3> <asp:Calendar id="calendar1" runat="server" ShowGridLines="True"/> </form> </body> </html> [JScript] <%@ Page Language="JScript" AutoEventWireup="True" %> <html> <head> </head> <body> <form runat="server"> <h3>Calendar Example</h3> <asp:Calendar id="calendar1" runat="server" ShowGridLines="True"/> </form> </body> </html> [Visual Basic] <%@ Page Language="VB" AutoEventWireup="True" %> <html> <script runat="server" > Sub Check_Change(sender As Object, e As EventArgs) ' Show or hide the gridlines in the Calendar control ' depending on the state of the ShowGridLinesCheckBox CheckBox ' control. If ShowGridLinesCheckBox.Checked Then Calendar1.ShowGridLines = True Else Calendar1.ShowGridLines = False End If End Sub </script> <body> <form runat="server"> <h3> Calendar ShowGridLines Example </h3> Select whether to show or hide the gridlines. <br><br> <asp:Calendar id="Calendar1" ShowTitle="True" runat="server"/> <br><br> <asp:CheckBox id="ShowGridLinesCheckBox" Text="Show/Hide gridlines" AutoPostBack="True" Checked="False" OnCheckedChanged="Check_Change" runat="server"/> </form> </body> </html> [C#] <%@ Page Language="C#" AutoEventWireup="True" %> <html> <script runat="server" > void Check_Change(Object sender, EventArgs e) { // Show or hide the gridlines in the Calendar control // depending on the state of the ShowGridLinesCheckBox CheckBox // control. if (ShowGridLinesCheckBox.Checked) { Calendar1.ShowGridLines = true; } else { Calendar1.ShowGridLines = false; } } </script> <body> <form runat="server"> <h3> Calendar ShowGridLines Example </h3> Select whether to show or hide the gridlines. <br><br> <asp:Calendar id="Calendar1" ShowTitle="True" runat="server"/> <br><br> <asp:CheckBox id="ShowGridLinesCheckBox" Text="Show/Hide gridlines" AutoPostBack="True" Checked="False" OnCheckedChanged="Check_Change" runat="server"/> </form> </body> </html>
[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
Calendar Class | Calendar Members | System.Web.UI.WebControls Namespace