Solved

Calendar

Posted on 2006-07-08
8
736 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
  • 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
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Expert Comment

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

Sammy
0
 
LVL 27

Accepted Solution

by:
Sammy 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
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…

679 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