Subject: Calendar Control
Posted By: stu9820 Post Date: 1/27/2004 4:46:35 PM
Is there a way to turn off the postback or the day links altogether for the calendar control?

Reply By: planoie Reply Date: 1/27/2004 5:25:05 PM
Use the DayRender event of the caledar control, and set the day item IsSelectable to false:

Private Sub calEndDate_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles calEndDate.DayRender
    e.Day.IsSelectable = False
End Sub

Peter
------------------------------------------------------
Work smarter, not harder.
Reply By: stu9820 Reply Date: 1/28/2004 8:54:40 AM
That worked thanks.  

Is there a way to handle, if IsSelectable is set to true, the day clicks?  For example, if someone clicks a day it pops up a window with information on that day.

Reply By: planoie Reply Date: 1/28/2004 10:22:09 AM
The .net Calendar control is a server control.  If doesn't provide any native functionality for client side events.  Add this to your DayRender handler:

e.Cell.Attributes.Add("onClick", String.Format("alert('{0}');", e.Day.Date))
e.Cell.Style.Add("cursor", "hand")

Modify the onclick client string to open your window.

Peter
------------------------------------------------------
Work smarter, not harder.

Go to topic 9069

Return to index page 961
Return to index page 960
Return to index page 959
Return to index page 958
Return to index page 957
Return to index page 956
Return to index page 955
Return to index page 954
Return to index page 953
Return to index page 952