|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Calendar control to display image on MondaysI am trying to get an image to appear on all Mondays within the calendar
control. I also want that image to be a link. How can I do this? Hi Dilworth,
Welcome to ASPNET newsgroup. As for the Calendar displaying Image on mondays question, I think we can make use of the Calendar control's DayRender event, this event occurs when the Caldenar control try rendering a Day Cell on it(for each day displaying ....). So we can put some code to check whether the current rendered day is monday, if so, clear the original controls in the cell and add our custom controls (hyperlink and image controls....). here is just a simple implementation which use a ASP.NET LiteralControl to inject a hyperlink with image: ======================= protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { System.Globalization.GregorianCalendar gc = new System.Globalization.GregorianCalendar(); DayOfWeek dow = gc.GetDayOfWeek(e.Day.Date); if (dow == DayOfWeek.Monday) { LiteralControl lc = new LiteralControl( @" <a href='http://www.asp.net'> <img src='Images/mon.GIF'/> </a> " ); e.Cell.Controls.Clear(); e.Cell.Controls.Add(lc); } ======================== Hope helps. Thanks, Steven Cheng Microsoft Online Support Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) -------------------- Show quoteHide quote | Thread-Topic: Calendar control to display image on Mondays microsoft.public.dotnet.framework.aspnet.webcontrols:32559| thread-index: AcYcN5/Azogx7Mm+RN6qWFOfu4HKTg== | X-WBNR-Posting-Host: 169.200.185.24 | From: "=?Utf-8?B?RGF2aWQ=?=" <dilworth@newsgroups.nospam> | Subject: Calendar control to display image on Mondays | Date: Wed, 18 Jan 2006 06:01:05 -0800 | Lines: 2 | Message-ID: <0BF5C765-2AF6-43CA-8BD9-668E43004***@microsoft.com> | MIME-Version: 1.0 | Content-Type: text/plain; | charset="Utf-8" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | Content-Class: urn:content-classes:message | Importance: normal | Priority: normal | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl | Xref: TK2MSFTNGXA02.phx.gbl Show quoteHide quote | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols | | I am trying to get an image to appear on all Mondays within the calendar | control. I also want that image to be a link. How can I do this? |
Help with GridView Update w/ Object Data Source needed
XHTML 1.1 and DIV 1 pixel in height Menu Control and Page Validation Dependent GridViews And CommandArguments how to get changed text from web control textbox A bug? Transparent Dynamic Item! Dropdownlist causes blank screen Adding errors by hand to a validationsummary? ImageButton inside of a WebPart not firing Clicked Event Free music - games - movies - software!!! |
|||||||||||||||||||||||