asp net 内联标签文本与标签控件
要在 asp .net 网页上绘制标签,最好使用内联代码,例如:
<%$ Resources:TextResource, Name %>
或设置它作为标签属性,例如:
我问是因为标签将使用视图状态并且不必在每次回发时读取 .resx 文件
to paint labels on an asp .net webpage, is it better to use inline code like:
<div><%$ Resources:TextResource, Name %></div>
or set it as a label property like:
<div><asp:Label ID="GuardarButton" runat="server" Text="<%$ Resources:TextResource, Name %>" /></div>
I'm asking because label will use viewstate and won't have to read .resx file on every postback
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
六个中的六个。一种需要视图状态,这需要处理/反序列化。另一个涉及读取缓存的资源。
如果您希望消除视图状态/修剪它,请使用资源文件,否则使用视图状态(假设页面上有许多控件)。
否则的话,也没有多大关系。
6 of one half dozen of the other. One requires viewstate, which requires processing/deserialization. the other involves reading a cached resource.
If you are looking to eliminate viewstate/trim it down, use the resource file otherwise viewstate (assuming many controls on the page).
Otherwise, it doesn't much matter.