Link to home
Start Free TrialLog in
Avatar of goodk
goodkFlag for United States of America

asked on

how do we initialize the calendar control with certain date?

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>
ASKER CERTIFIED SOLUTION
Avatar of jijeesh
jijeesh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of goodk

ASKER

and how do we initialize the calendar to a particular date/month? like I want it to have August 2000 when the calendar appear?
Avatar of goodk

ASKER

Label1.Text = "The selected date is " + Calendar1.SelectedDate.ToShortDateString();

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

ASKER

partial answer