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

IT Services And Support

Email : ren@techsolus.co.uk
Mobile Phone : 0788 68 41 411
Answerphone : 01204 469683
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 & e.day.date.tolongdatestring
 qwe = qwe & "#"

 dbconn.open

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

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

 dbconn.close
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". 

Simples

Post A Comment

Name Comment
programming services asp.net specialist
Valid XHTML 1.0 Transitional
Admin
GD