A
Abraham Andres Luna
hello everyone,
i'm having a hard time setting the selected date in a custom control. below
is the custom control code:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace IS.WebControls
{
public class ISBaseCalendar : Control
{
Calendar cCalendar;
protected override void OnInit(EventArgs E)
{
base.OnInit(E);
this.cCalendar = new Calendar();
this.cCalendar.SelectedDate = DateTime.Now;
this.Controls.Add(cCalendar);
}
}
}
below is the page code:
<%@ Page Language="C#" %>
<html>
<head>
<title>Test Page</title>
</head>
<body>
<form runat="server">
<IS:ISBaseCalendar id="cDTECA" runat="server" />
</form>
</body>
</html>
when you navigate to the page, today's date is not selected. i also tried
setting the date after adding the calendar to my control:
this.cCalendar = new Calendar();
this.Controls.Add(cCalendar);
this.cCalendar.SelectedDate = DateTime.Now;
and it still doesn't work. please help me in resolving this issue. i've
tested other properties, like ShowTitle, etc. and all they all work as
expected.
i'm having a hard time setting the selected date in a custom control. below
is the custom control code:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace IS.WebControls
{
public class ISBaseCalendar : Control
{
Calendar cCalendar;
protected override void OnInit(EventArgs E)
{
base.OnInit(E);
this.cCalendar = new Calendar();
this.cCalendar.SelectedDate = DateTime.Now;
this.Controls.Add(cCalendar);
}
}
}
below is the page code:
<%@ Page Language="C#" %>
<html>
<head>
<title>Test Page</title>
</head>
<body>
<form runat="server">
<IS:ISBaseCalendar id="cDTECA" runat="server" />
</form>
</body>
</html>
when you navigate to the page, today's date is not selected. i also tried
setting the date after adding the calendar to my control:
this.cCalendar = new Calendar();
this.Controls.Add(cCalendar);
this.cCalendar.SelectedDate = DateTime.Now;
and it still doesn't work. please help me in resolving this issue. i've
tested other properties, like ShowTitle, etc. and all they all work as
expected.