Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Calendar

Posted on 2006-07-08
8
Medium Priority
?
741 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 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
Independent Software Vendors: 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 Ageil
ID: 17066458
Ok, I will post the code for you later tonight.

Sammy
0
 
LVL 27

Accepted Solution

by:
Sammy Ageil earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
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 …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Loops Section Overview
Suggested Courses

972 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