Solved

how do we initialize the calendar control with certain date?

Posted on 2011-03-08
4
782 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
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…
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 …

685 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