possible calendar bug

  • Thread starter Abraham Andres Luna
  • Start date
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.
 
A

Abraham Andres Luna

i did some testing, and the date is selected. for some reason it isn't
styled correctly. i guess having the calendar as part of a custom control
breaks the styling. please help with this bug.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top