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
Solved

500 PONTS!!! Creating a Calendar

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 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