Solved

how do we initialize the calendar control with certain date?

Posted on 2011-03-08
4
776 Views
Last Modified: 2012-05-11
1- like If the user click the text boxt to change, after first time,  I want the same month year appears.
2- I tried width and height but the calendar control did not went below 16px? How can I make the calendar picker very small with small fonts?
I am using asp.net
thanks

<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>

   <script language="C#" runat="server">

      void Selection_Change(Object sender, EventArgs e)
      {
         Label1.Text = "The selected date is " + Calendar1.SelectedDate.ToShortDateString();
      }

   </script>

</head>    
<body>

   <form runat="server">

      <h3>Calendar Example</h3>

      Select a date on the Calendar control.<br><br>

      <asp:Calendar ID="Calendar1" runat="server"  
           SelectionMode="Day"
           ShowGridLines="True"
           OnSelectionChanged="Selection_Change">
 
         <SelectedDayStyle BackColor="Yellow"
                           ForeColor="Red">
         </SelectedDayStyle>
     
      </asp:Calendar>    

      <hr><br>

      <asp:Label id="Label1" runat=server />

   </form>
</body>
</html>
0
Comment
Question by:goodk
  • 3
4 Comments
 
LVL 5

Accepted Solution

by:
jijeesh earned 500 total points
ID: 35074536
You can set the property of font of calendar control as you required.

<asp:Calendar ID="Calendar1" runat="server"  
           SelectionMode="Day" 
           ShowGridLines="True"
           OnSelectionChanged="Selection_Change" Font-Bold="True" Font-Size="5pt">
 
         <SelectedDayStyle BackColor="Yellow"
                           ForeColor="Red">
         </SelectedDayStyle>
      
      </asp:Calendar>

Open in new window

0
 

Author Comment

by:goodk
ID: 35075056
and how do we initialize the calendar to a particular date/month? like I want it to have August 2000 when the calendar appear?
0
 

Author Comment

by:goodk
ID: 35075122
Label1.Text = "The selected date is " + Calendar1.SelectedDate.ToShortDateString();

just the reverse of the above.  Like the calendar1.??=Label1.Text;
0
 

Author Closing Comment

by:goodk
ID: 35096710
partial answer
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

757 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

20 Experts available now in Live!

Get 1:1 Help Now