Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

500 PONTS!!! Creating a Calendar

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
ScubeduFan
Asked:
ScubeduFan
1 Solution
 
sandip132Commented:
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
 
satyendrastomarCommented:
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
 
Niraj_SinghCommented:

 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
 
ScubeduFanAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now