Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Calendar Control

Posted on 2007-11-28
4
Medium Priority
?
329 Views
Last Modified: 2012-06-27
This is not an exam or homework

The code snippet below shows a Calendar and a Label control added to a simple Web site. The selection mode is set to DayWeekMonth:

<asp:Calendar id="Calendar1" runat="server" DayNameFormat="Short" SelectionMode="DayWeekMonth">
</asp:Calendar>
<asp:Label id="Label1" runat="server"/>

Once a user makes a selection, you need to write code in the Calendar1 SelectionChanged event to evaluate if a user clicked on a day, week or month and write the result to Label1

Whick of the following code segments will acheve the stated goals?

1.
Select Case Calendar1.SelectedDates.Count
  Case 1 'Day
     Label1.Text="You have selected a day."
  Case 7 'Week
     Label1.Text="You have selected a week."
  Case is > 7
     Label1.Text="You have selected a month."
End Select

2.
Select Case Calendar1.SelectionMode
  Case "Day"
     Label1.Text="You have selected a day."
  Case "Week"
     Label1.Text="You have selected a week."
  Case "Month"
     Label1.Text="You have selected a month."
End Select

3.
Select Case Calendar1.Count
  Case 1 'Day
     Label1.Text="You have selected a day."
  Case 7 'Week
     Label1.Text="You have selected a week."
  Case Is > 7
     Label1.Text="You have selected a month."
End Select

4.

Select Case Calendar1.SelectedMode.Current
  Case "Day"
     Label1.Text="You have selected a day."
  Case "Week"
     Label1.Text="You have selected a week."
  Case "Month"
     Label1.Text="You have selected a month."
End Select
0
Comment
Question by:cybernation989
[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 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20364217
A quick glance at the properties of the calendar control will tell you the correct answer.

note: answer #2 is obviously wrong, I hope you see that..
0
 

Author Comment

by:cybernation989
ID: 20364343
Great example of code at http://msdn2.microsoft.com/en-us/library/dxf9k8sh(vs.71).aspx

I have to go with answer 1 but then again I have been wrong many of times.
VB
 
Sub Date_Selected(sender as Object sender, e As EventArgs)
   Select (Calendar1.SelectedDates.Count)
      Case 0:    'None
         Label1.Text = "No dates are currently selected"
      Case 1:    'Day
         Label1.Text = "The selected date is " & _ 
                       Calendar1.SelectedDate.ToShortDateString
      Case 7:    'Week
         Label1.Text = "The selection is a week beginning " & _
                       Calendar1.SelectedDate.ToShortDateString
      Case Else: 'Month
         Label1.Text = "The selection is a month beginning " & _
                       Calendar1.SelectedDate.ToShortDateString
   End Select
End Sub

Open in new window

0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 20364356
yes, that answer would be correct!
0
 

Author Comment

by:cybernation989
ID: 20364417
Hey I got one... hands angelIII a beer
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

636 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