Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 694
  • Last Modified:

calendar object in c# asp.net styling properties adding a gridlines and no border

Hi,

I have a calendar in an asp.net page and would like to add gridlines around each date and remove the border and also if possible add a darker line between friday and saturday as shown in the proposed calendar file. Can anyone assist me with this?

Thanks

<asp:Calendar id="Calendar1"
                     OnSelectionChanged="Date_Selected"
                     width="429px"
                     height="280px"
                     Font-Name="Verdana" 
                     Font-Size="16px"
                     padding-left="5px"
                     NextPrevFormat="ShortMonth"
                     border-style="none"
                     text-decoration="none"
                     runat="server">
                   <TodayDayStyle />
                   <DayHeaderStyle Font-Bold="True"/>
                   <OtherMonthDayStyle ForeColor="gray"/>
                   <TitleStyle BackColor="#ffffff"
                               ForeColor="#000"
                               Font-Bold="True"/>
 
                   <SelectedDayStyle BackColor="#336633"
                                     Font-Bold="True"
                                     />
                   <NextPrevStyle ForeColor="#000"
                                  Font-Size="12px"/>
                   <SelectorStyle BackColor="#336633" 
                                  ForeColor="navy"
                                  Font-Size="9px"/>
                </asp:Calendar>

Open in new window

calendar1.jpg
proposedcalendar.jpg
0
CharlieDev
Asked:
CharlieDev
  • 4
  • 3
3 Solutions
 
Anurag ThakurCommented:
something like this?
<asp:Calendar ID="Calendar1" runat="server" BorderStyle="Double" BorderWidth="4px" BorderColor="green" DayStyle-BorderStyle="Solid" DayStyle-BorderWidth="1px" Font-Names="Verdana" Font-Size="16px" Height="280px" NextPrevFormat="ShortMonth" Width="429px">
	<TodayDayStyle />
	<DayHeaderStyle Font-Bold="True" />
	<OtherMonthDayStyle ForeColor="gray" />
	<TitleStyle BackColor="#ffffff" Font-Bold="True" ForeColor="#000" />
	<SelectedDayStyle BackColor="#336633" Font-Bold="True" />
	<NextPrevStyle Font-Size="12px" ForeColor="#000" />
	<SelectorStyle BackColor="#336633" Font-Size="9px" ForeColor="navy" />
</asp:Calendar>

Open in new window

0
 
CharlieDevAuthor Commented:
Great thanks, just one last thing, can I get rid of the underline on each day i've tried text-decoration="none" but it hasnt had any effect.

cheers
0
 
CharlieDevAuthor Commented:
Sorry another thing, is it possible to make the days that have already passed to be grey and the current day and days to come to stay black?

Many thanks
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Anurag ThakurCommented:
removing the hyperlink i have no idea but as far as older/past dates are concerned you an override the dayrendered event
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.calendar.dayrender.aspx
0
 
CharlieDevAuthor Commented:
Thanks, I'm very new to all this , could you possibly give a bit of an example as to how I would use this?
Does the " public event DayRenderEventHandler DayRender " bit control the calendar automatically, so I could write some code in there to get datetime now and then find all dates before the current date and set the background of those to be a different color? Do I have the right idea?
Cheers
0
 
Anurag ThakurCommented:
0
 
CharlieDevAuthor Commented:
Thanks :)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now