Rendering Links
I've been writing some custom controls and I have several controls in a composite controls that have links. Take this custom CompositeControl, for example, where I define a calendar:
private Calendar _calendarControl =null;
// properties to expose calendar properties
protected override void CreateChildControls()
{
this.Controls.Clear();
_calendarControl = new Calendar();
//assign default properties
}
protected override void Render(HtmlTextWriter writer)
{
//render table HTML
_calendarControl.Render(writer)
//other controls rendered, as well as table
}
The problem was none of the links worked! They rendered as static text. This happened with linkbuttons as well. I had never seen that before; changing to defining a Table server control in the CreateChildControls class, and adding the controls there, worked well to correct the problem.