Link to home
Start Free TrialLog in
Avatar of Higgster
Higgster

asked on

Calendar onclick

Hi,

  Is there a way to get a confirmation msg on the asp calender?
  I need to set curtain dates from a table to show a warning before the user continues.

  I have tried the following and it all works other than the onclick.

For i As Integer = 0 To tblInstallerClearDays.Rows.Count - 1
    ClearDayDate = Convert.ToDateTime(tblInstallerClearDays.Rows(i)("ClearDayDate"))
    If e.Day.Date = ClearDayDate Then
        e.Cell.Font.Bold = True
        e.Cell.ForeColor = Drawing.Color.Blue
        e.Cell.Attributes.Add("onclick", "confirm('This day is set to be clear,\nare you sure you want to continue?')")
    End If
Next

Thanks
Avatar of GiftsonDJohn
GiftsonDJohn
Flag of India image

you have to use a return on the confirm

For i As Integer = 0 To tblInstallerClearDays.Rows.Count - 1
    ClearDayDate = Convert.ToDateTime(tblInstallerClearDays.Rows(i)("ClearDayDate"))
    If e.Day.Date = ClearDayDate Then
        e.Cell.Font.Bold = True
        e.Cell.ForeColor = Drawing.Color.Blue
        e.Cell.Attributes.Add("onclick", "return confirm('This day is set to be clear,\nare you sure you want to continue?')")
    End If
Next
Avatar of Higgster
Higgster

ASKER

Hi,

Thanks, just tried that but still no joy, if I take the "If" out, and run the code for every date in the calendar it works fine???
ASKER CERTIFIED SOLUTION
Avatar of GiftsonDJohn
GiftsonDJohn
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks