Solved

how do we initialize the calendar control with certain date?

Posted on 2011-03-08
4
786 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
[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
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

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…
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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

707 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