A
Alexandr Zverev
Hello.
I would like to develop control which will contain Calendar with some
addition logic in each cell. I found the way to customize each sell using
Calendar1_DayRender method which alow to :
TableCell c = ((DayRenderEventArgs)e).Cell;
c.Controls.Add(new TextBox());
This code shows textbox in each cell of the Calendar.
I said "great" and created simple custom control and tryed to put it on each
sell, but... it didn't show.
here is the code
public partial class DayCtrl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
this.Label1.Text = "invoked!";
}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
writer.Write("Say hello to all!");
}
}
And I also added code to Calendar1_DayRender method:
DayCtrl dc = new DayCtrl();
c.Controls.Add(dc);
Nothing but "Say hello to all!" - without any Labels, Buttons, which were on
control as well. I noticed what during invocation of it's Render method -
all children controls of DayCtrl were null.
"Ok" - said me. And changed code in Calendar1_DayRender method:
System.Web.UI.Control dc = Page.LoadControl("/calendar/DayCtrl.ascx");
//DayCtrl dc = new DayCtrl();
c.Controls.Add(dc);
Great. Control was shown. But I found out what the event of the LinkButton1
in this control doesn't invoking.
What's wrong how could I add simple user control to the cell of the Calendar
and catch events for buttons?
Alex Zverev
I would like to develop control which will contain Calendar with some
addition logic in each cell. I found the way to customize each sell using
Calendar1_DayRender method which alow to :
TableCell c = ((DayRenderEventArgs)e).Cell;
c.Controls.Add(new TextBox());
This code shows textbox in each cell of the Calendar.
I said "great" and created simple custom control and tryed to put it on each
sell, but... it didn't show.
here is the code
public partial class DayCtrl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
this.Label1.Text = "invoked!";
}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
writer.Write("Say hello to all!");
}
}
And I also added code to Calendar1_DayRender method:
DayCtrl dc = new DayCtrl();
c.Controls.Add(dc);
Nothing but "Say hello to all!" - without any Labels, Buttons, which were on
control as well. I noticed what during invocation of it's Render method -
all children controls of DayCtrl were null.
"Ok" - said me. And changed code in Calendar1_DayRender method:
System.Web.UI.Control dc = Page.LoadControl("/calendar/DayCtrl.ascx");
//DayCtrl dc = new DayCtrl();
c.Controls.Add(dc);
Great. Control was shown. But I found out what the event of the LinkButton1
in this control doesn't invoking.
What's wrong how could I add simple user control to the cell of the Calendar
and catch events for buttons?
Alex Zverev