Solved

Calendar

Posted on 2006-07-08
8
738 Views
Last Modified: 2008-03-17
See this linke  - http://www.expedia.com/Default.asp?CCheck=1&   When we click on a departing, a little Calendar pops up, can that be in in ASP.net, Vb.net 2005?
0
Comment
Question by:VBdotnet2005
[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
  • 4
  • 3
8 Comments
 
LVL 12

Expert Comment

by:deanvanrooyen
ID: 17066080
c#  you can convert  it http://www.codeproject.com/Purgatory/ASPNET_with_C_.asp

good one I use - http://www.15seconds.com/issue/040315.htm

I suspect this can also be done with a calendar in a div using absolute postion value - then use javascript to make the div visible when the text box is clicked and make the calendar invisible when the calender is clicked. I dont have code examples of this.
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 17066238
take a look at http://itteam.ca/book.aspx if thats something you would like, let me know and I post the code for you.

0
 

Author Comment

by:VBdotnet2005
ID: 17066410
That is exactly what I need. Can you provide me the code in VB.net?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 17066458
Ok, I will post the code for you later tonight.

Sammy
0
 
LVL 27

Accepted Solution

by:
Sammy Ageil earned 500 total points
ID: 17066486
Found the code on this machine and added some comments so you have an understanding on things work here
///ASPX code and client script
<script type="text/javascript">
function ToggleCal(){//Toggle Calendar Visibilty of the calendar control inside the divCal
if(document.getElementById('divCal').style.display=='none')
document.getElementById('divCal').style.display='block'
else
document.getElementById('divCal').style.display='none';
}
</script>
<asp:Label ID="lblDate" runat="server" CssClass="lbl" Text="Click Here To View Calendar"></asp:Label>
                    <div id="divCal" style="position: absolute; right: 380px; top: 330px; display: none;">
                        <asp:Calendar ID="CalBook" runat="server" NextMonthText=" >" CssClass="Cal" NextPrevStyle-CssClass="NextPrev" TodayDayStyle-CssClass="TodayStyle"
                            DayStyle-CssClass="DayStyle" ShowGridLines="true" NextPrevFormat="ShortMonth">
                            <WeekendDayStyle CssClass="WeekendStyle" />
                            <OtherMonthDayStyle CssClass="OtherMonthDayStyle" />
                            <SelectedDayStyle CssClass="SelectedDayStyle" />
                            <DayHeaderStyle CssClass="DayHeader" />
                            <TitleStyle CssClass="TitleStyle" />
                            <DayStyle CssClass="DayStyle" />
                            <NextPrevStyle CssClass="NextPrev" />
                        </asp:Calendar>
                    </div>
///End aspx code
'Start VB.NET Code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 Me.lblDate.Attributes.Add("onclick", "javascript:ToggleCal();") 'Plug in the client side script to the label control
End Sub
 Protected Sub CalBook_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles CalBook.DayRender
        Dim dtToday As DateTime = DateTime.Now.ToShortDateString
        If e.Day.Date < dtToday Then 'Check date if its past in the calendar
            e.Day.IsSelectable = False 'dont make past days selectable
        End If
    End Sub
    Protected Sub CalBook_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CalBook.SelectionChanged
        Me.lblDate.Text = Me.CalBook.SelectedDate.ToShortDateString 'show the selected date in the label control

        CalBook.VisibleDate = Me.CalBook.SelectedDate 'make sure the calendar control knows which date is selected when its hidden

    End Sub
---End VB.Net code-

Enjoy

Sammy
0
 
LVL 12

Expert Comment

by:deanvanrooyen
ID: 17067394
thats nice and clean,

also but i would suggest the above
http://atlas.asp.net/atlastoolkit/PopupControl/PopupControl.aspx
0
 
LVL 12

Expert Comment

by:deanvanrooyen
ID: 17077304
hi Sammy,

I like your code as i battled with using a popup calendar (in an aspx pop up page) to set the text of a textbox to the date, I also like it as i have used it to "toggle" a calendar control in a gridview row of a gridview, and it looks clean even with lots of rows, this is a simple emplentation that is very flexible

thanks!
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 17078304
You are welcome Dean,
I had no problem with the popup or setting up the selected date. The painful task was applying CSS classes to get rid of the default grey.
I had to come up with hacks to allow the calendar to change colors based on the selected style on http://itteam.ca

Enjoy :-)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

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