consultancy chorley ASP.NET Server Side Scripting Wigan
Website Development Radcliffe

A Coder's Notes

Email :
bespoke invoice systems Standish Information Technology Advice Worsley
    development systems Ramsbottom
data manipulation Farnworth access databases Whitefield SQL connections Atherton
online accessible software Leyland software compatible Coppull

Get connected and Online Tottington
remote management Makerfield code and design Aspull

ASP.Net OnDayRender Fill Calendar From Database - 25/10/2012

So...simples yet important

For the calendar in the webpage...

<asp:calendar id = "cal"
              OnSelectionChanged = "docal"
              runat = "server"
              ondayrender = "doday"

The main thing to see it the "ondayrender" bit.  That points to the code that is rendered, or run in plain english, when the calendar is put together.  Think of it as when .Net is putting each day of the calendar in it runs a little program referred to under ondayrender

sub doday(sender as object, e as dayrendereventargs)
 qwe = "SELECT uidf FROM weathert WHERE datef = #"
 qwe = qwe &
 qwe = qwe & "#"

 runcommand = new oledbcommand(qwe, dbconn)
 dbread = runcommand.executereader

 if dbread.hasrows = true then
  e.Cell.BackColor = System.Drawing.Color.Crimson
 end if

end sub

So there's the code that will be run as each day of the aclendar is put in place.  Notice "e as dayrendereventargs".  The various settings in the calendar can be accessed through the "e". 


Post A Comment

Name Comment
programming services specialist
Valid XHTML 1.0 Transitional