C
Craig Glencross
I have created a Composite Control in C# 2005 for ASP. It has 3 buttons, a
calendar control and some drop down lists.
It compiles correctly and I can use it on a test web site but I cannot
control where to place it on the web page.
I have tried positioning tags such as relative or absoulte. Can you explain
what I am missing? Do I have to expose the style property? Her e is the
Render function:
//-------------------------------------------------------------------------------
// Place the child controls in the correct positions on this control
//-------------------------------------------------------------------------------
public override void RenderControl(HtmlTextWriter writer)
{
writer.RenderBeginTag(HtmlTextWriterTag.Table);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
txtCalendar.RenderControl(writer);
btnCalendar.RenderControl(writer);
writer.RenderEndTag(); // td
writer.RenderEndTag(); // tr
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
calMain.RenderControl(writer);
writer.RenderEndTag(); // td
writer.RenderEndTag(); // tr
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
ddlHours.RenderControl(writer);
ddlMinutesMajor.RenderControl(writer);
ddlMinutesMinor.RenderControl(writer);
ddlAMorPM.RenderControl(writer);
writer.RenderEndTag(); // td
writer.RenderEndTag(); // tr
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
btnUpdate.RenderControl(writer);
btnCancel.RenderControl(writer);
writer.RenderEndTag(); // td
writer.RenderEndTag(); // tr
writer.RenderEndTag(); // table
}
Thanks.
calendar control and some drop down lists.
It compiles correctly and I can use it on a test web site but I cannot
control where to place it on the web page.
I have tried positioning tags such as relative or absoulte. Can you explain
what I am missing? Do I have to expose the style property? Her e is the
Render function:
//-------------------------------------------------------------------------------
// Place the child controls in the correct positions on this control
//-------------------------------------------------------------------------------
public override void RenderControl(HtmlTextWriter writer)
{
writer.RenderBeginTag(HtmlTextWriterTag.Table);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
txtCalendar.RenderControl(writer);
btnCalendar.RenderControl(writer);
writer.RenderEndTag(); // td
writer.RenderEndTag(); // tr
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
calMain.RenderControl(writer);
writer.RenderEndTag(); // td
writer.RenderEndTag(); // tr
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
ddlHours.RenderControl(writer);
ddlMinutesMajor.RenderControl(writer);
ddlMinutesMinor.RenderControl(writer);
ddlAMorPM.RenderControl(writer);
writer.RenderEndTag(); // td
writer.RenderEndTag(); // tr
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
btnUpdate.RenderControl(writer);
btnCancel.RenderControl(writer);
writer.RenderEndTag(); // td
writer.RenderEndTag(); // tr
writer.RenderEndTag(); // table
}
Thanks.