Solved

Calendar

Posted on 2006-07-08
8
730 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
Comment Utility
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
Comment Utility
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
Comment Utility
That is exactly what I need. Can you provide me the code in VB.net?
0
 
LVL 27

Expert Comment

by:Sammy
Comment Utility
Ok, I will post the code for you later tonight.

Sammy
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 27

Accepted Solution

by:
Sammy earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now