Solved

Calendar onclick

Posted on 2009-05-05
4
276 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now