render control runtime


protected override void Render(HtmlTextWriter writer)
{
Control objCtrl = default(Control);
TextBox objTextbox = new TextBox();

writer.RenderBeginTag(HtmlTextWriterTag.Table);
writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, “5px”);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
objCtrl = LoadControl(“../uscSPCalendar.ascx”);
objTextbox.ID = “txt1”;
//objTextbox.RenderControl(writer);ถ้าต้องการวาด control ก่อน render
base.Controls.Add(objCtrl);
base.Controls.Add(objTextbox);
base.Render(writer);
writer.RenderEndTag();//td
writer.RenderEndTag();//tr
writer.RenderEndTag();//table
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: