Solved

500 PONTS!!! Creating a Calendar

Posted on 2006-11-19
4
188 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
[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 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

Technology Partners: 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!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

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