Note that there are some explanatory texts on larger screens.

plurals
  1. POMake asp:calendar cell clickable, not just the number
    primarykey
    data
    text
    <p>I have a c# web app that has a calendar - nothing special. The problem I have is that only the numbers can be clicked on and not the entire cell. I've added a onmouseover type handler that makes the cell change color when it's moused over but that's misleading because you can't click on the edge. </p> <p>Is there any way in asp.net c# that I can make this calendar allow the entire cell to be clickable and not just the hypertext number of the date? I hope I've explained it well enough.</p> <p>Thanks</p> <pre><code>&lt;asp:Calendar ID="Calendar1" runat="server" DayStyle-ForeColor="DarkBlue" DayHeaderStyle-BackColor="#FEF6CB" DayStyle-Height="25" SelectedDayStyle-BackColor="#003F7D" SelectedDayStyle-ForeColor="White" DayNameFormat="FirstLetter" ShowGridLines="true" BorderColor="Black" TitleStyle-BackColor="#003F7D" TitleStyle-ForeColor="White" TitleStyle-CssClass="CalHeader" NextPrevStyle-CssClass="CalNextPrev" NextPrevStyle-ForeColor="White" OnVisibleMonthChanged="cal_ReserveDate_VisibleMonthChanged" OnDayRender="cal_ReserveDate_DayRender" OnSelectionChanged="cal_ReserveDate_SelectionChanged" DayStyle-BorderColor="Black" SelectedDayStyle-CssClass="CalendarSelectedDay" Width="97%" /&gt; </code></pre> <p><strong>UPDATE:</strong><br> Here is the basic framework of the ascx page:</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="BuyTourProductDialogGalaxy2.ascx.cs" Inherits="ConLib_Custom_BuyTourProductDialog2" %&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; function fixCalendar() { var a = $('#&lt;%=cal_ReserveDate.ClientID%&gt; a '); a.contents().wrap("&lt;div/&gt;"); } &lt;/script&gt; &lt;asp:UpdatePanel ID="upnl_Cal" runat="server" ChildrenAsTriggers="true" UpdateMode="Always"&gt; &lt;ContentTemplate&gt; &lt;div class="BuyTourProductDialog"&gt; &lt;table cellpadding="0" cellspacing="0" border="0" width="100%"&gt; &lt;tr&gt; &lt;td colspan="2" width="75%"&gt; &lt;asp:Label ID="lblInstructions" runat="server" Text="" EnableViewState="False" CssClass="ReservationInstructions" /&gt; &lt;/td&gt; &lt;td width="25%"&gt; &lt;span style="float: right;"&gt; &lt;asp:Button ID="btn_Reset" runat="server" Text="Reset" OnClick="btn_Reset_Click" Visible="false" CssClass="ResetButton" /&gt; &lt;asp:Button ID="btn_Reserve" runat="server" Text="Reserve" OnClick="btn_Reserve_Click" Visible="true" /&gt; &lt;asp:Button ID="btn_AddToCart" runat="server" Text="Add To Cart" Visible="false" OnClick="btn_AddToCart_Click" /&gt; &lt;asp:Button ID="btn_Continue" runat="server" Text="Continue" Visible="false" OnClick="btn_Continue_Click" /&gt; &lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;%-- Calendar Panel --%&gt; &lt;asp:Panel ID="pnl_GatewayCalendar" runat="server" Visible="false"&gt; &lt;table width="100%"&gt; &lt;%-- Header --%&gt; &lt;tr&gt; &lt;td align="center" colspan="2"&gt; &lt;asp:Label ID="lbl_SelectedDate" runat="server" Font-Bold="true" CssClass="SelectedDate" /&gt;&lt;br /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;%-- Calendar side --%&gt; &lt;td width="50%" valign="top"&gt; &lt;asp:Calendar ID="cal_ReserveDate" runat="server" DayStyle-ForeColor="DarkBlue" DayHeaderStyle-BackColor="#FEF6CB" DayStyle-Height="25" SelectedDayStyle-BackColor="#003F7D" SelectedDayStyle-ForeColor="White" DayNameFormat="FirstLetter" ShowGridLines="true" BorderColor="Black" TitleStyle-BackColor="#003F7D" TitleStyle-ForeColor="White" TitleStyle-CssClass="CalHeader" NextPrevStyle-CssClass="CalNextPrev" NextPrevStyle-ForeColor="White" OnVisibleMonthChanged="cal_ReserveDate_VisibleMonthChanged" OnDayRender="cal_ReserveDate_DayRender" OnSelectionChanged="cal_ReserveDate_SelectionChanged" DayStyle-BorderColor="Black" SelectedDayStyle-CssClass="CalendarSelectedDay" Width="97%" /&gt; &lt;/td&gt; &lt;%-- Event Times side --%&gt; &lt;td valign="top"&gt; &lt;%-- Another section here for tour times. --%&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;/div&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload