开发者

ASP.NET Webforms write output html for control

开发者 https://www.devze.com 2023-04-01 17:57 出处:网络
I want to create my own hierarchical navigation menu control without using standart ASP.NET controls. So, I want to control my html output and I found out that I can override Render method to write ht

I want to create my own hierarchical navigation menu control without using standart ASP.NET controls. So, I want to control my html output and I found out that I can override Render method to write html into respose. Is it good place for this? Where in control creating lifecycle I should prepare data for my control?

protected override void Render(HtmlTextWriter writer)
{
    ba开发者_如何转开发se.Render(writer);
    Response.Write("<b>hello</b>");
}


It is exactly the Render method that is the correct place to do this. But don't write it to the Response, write it to the provided as argument HtmlTextWriter instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号