Solved

Calendar onclick

Posted on 2009-05-05
4
277 Views
Last Modified: 2012-05-06
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
0
Comment
Question by:Higgster
  • 2
  • 2
4 Comments
 
LVL 14

Expert Comment

by:GiftsonDJohn
ID: 24303037
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
0
 

Author Comment

by:Higgster
ID: 24303074
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???
0
 
LVL 14

Accepted Solution

by:
GiftsonDJohn earned 125 total points
ID: 24303090
Chage the following line

If e.Day.Date = ClearDayDate Then

To

If e.Day.Date.Equals(ClearDayDate.Date) Then
0
 

Author Closing Comment

by:Higgster
ID: 31577931
Thanks
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question