开发者

ASP.NET: HtmlGenericControl("div") or Panel

Is开发者_如何学编程 there any difference in overhead between using Panel or HtmlContainerControl when needing to create a serverside container in ASP.NET.

HtmlContainerControl Container = new HtmlGenericControl("div");

Or

Panel Container = new Panel();

Also, are there any differences in how it is rendered in different browsers? I've noticed that Panel seems to render as a div in all browsers I have used.


Panel supports extra functionality such as Direction, BackImageUrl, ScrollBars, etc... However if all you need is a div, I would use HtmlGenericControl.

It is explicit which makes for better code readability. It also gives you more control over the markup, e.g. you may not agree with how something like BackImageUrl has been implemented by Microsoft.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜