开发者

Do webcontrols have any disadvantage over html server controls?

开发者 https://www.devze.com 2023-01-17 13:46 出处:网络
I just thought I should ask because It doesn\'t make sense to me that both versions exist. Is this just for compatiblity with older HTML programmers?

I just thought I should ask because It doesn't make sense to me that both versions exist. Is this just for compatiblity with older HTML programmers?

They both can do the exact same thing when runat="server" is set, right? Unfortunately my book on the subject does not really elaborate on this, and I couldn't find anything on Google.

Is it possible that w开发者_JAVA技巧ebcontrols are slower because they "wrap a little more"?


Yes web controls put more strain on the CPU/RAM. However they provide better abstraction.

Many html form tags have attributes that do not accept boolean values.

If you are assinging a boolean value this could be a pain in the ass, look at this:

cbMain.Checked = User.IsAdmin()

instead of:

txtMain.checked = If(User.IsAdmin(), "checked", "")

Others have unintuitive attributes and values.

Another point to mention is that some controls render html composed of multiple tags. For example a checkbox and a label. If you were using html controls you would have to create separate controls yourself.

So basically its just for usability and abstraction.

0

精彩评论

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

关注公众号