Solved

500 PONTS!!! Creating a Calendar

Posted on 2006-11-19
4
184 Views
Last Modified: 2012-06-27
How do I remove the underlines from NextPrevStyle and the DayStyle and also how do I preselect todays date (so it's highlighted) on the initial load of the Calendar object?
0
Comment
Question by:ScubeduFan
4 Comments
 
LVL 12

Expert Comment

by:sandip132
ID: 17976572
Just add this style in your html's <HEAD> tag.
<STYLE type="text/css">
<!--
A { text-decoration:none }
-->
</STYLE>

By default the calender control selects server's todays date.
0
 
LVL 1

Accepted Solution

by:
satyendrastomar earned 500 total points
ID: 17977487
Hi,


  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not Page.IsPostBack Then
            calDate.SelectedDate = DateTime.Now.ToString
        End If
  End Sub



 Private Sub calDate_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles calDate.DayRender

        '// Clear the link from this day
        e.Cell.Controls.Clear()

        '// Add the custom link
        Dim Link As System.Web.UI.HtmlControls.HtmlGenericControl
        Link = New System.Web.UI.HtmlControls.HtmlGenericControl
        Link.TagName = "a"
        Link.InnerText = e.Day.DayNumberText
        '<p class="speciallink"><
        Link.Attributes.Add("href", String.Format("JavaScript:window.returnValue = '{1:d}'; window.close();", Request.QueryString("field"), Format(e.Day.Date, "dd/MM/yyyy")))
        'Link.Attributes.Add("href", String.Format("JavaScript:window.returnValue = '{1:d}'; window.close();", Request.QueryString("field"), e.Day.Date))

        '// By default, this will highlight today's date.
        If e.Day.IsSelected Then
            Link.Attributes.Add("style", Me.calDate.SelectedDayStyle.ToString())
        End If

        '// Now add our custom link to the page
        e.Cell.Controls.Add(Link)

    End Sub

Write this code in to your code behind u will get a calender control which select today's date as default. also write this script tag in your .aspx page

<STYLE type="text/css">
<!--
A { text-decoration:none }
-->
</STYLE>

Regards,
Satyendra
0
 
LVL 6

Expert Comment

by:Niraj_Singh
ID: 17978900

 Do you want to use the javascript calender or asp.net inbuild calender.
 if you are thinking of using javascript calender then u cal get many calenders and u will just have to include reference in your code.
 
0
 

Author Comment

by:ScubeduFan
ID: 17992612
sandip ... you got the easy part (the CSS), but your answer on the calendar was wrong.

satyendrastomar ... thanks for the code .... this is exactly what I was needed ...

<script Language="VB" Runat="Server">
  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not Page.IsPostBack Then
            Calendar1.SelectedDate = DateTime.Now.ToString
        End If
  End Sub
</script>
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

Suggested Solutions

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

10 Experts available now in Live!

Get 1:1 Help Now