Solved

Calendar onclick

Posted on 2009-05-05
4
279 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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