Solved

Calendar

Posted on 2006-07-08
8
737 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
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
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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Testing of the web services 1 80
Can Angular be used with classic asp.net? 3 45
asp.net mvc5 6 34
Textbox autocomplete using jquery in asp.net 13 49
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Suggested Courses

738 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