asp net 内联标签文本与标签控件

发布于 2024-12-05 19:19:48 字数 315 浏览 6 评论 0原文

要在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨落星ぅ辰 2024-12-12 19:19:48

六个中的六个。一种需要视图状态,这需要处理/反序列化。另一个涉及读取缓存的资源。

如果您希望消除视图状态/修剪它,请使用资源文件,否则使用视图状态(假设页面上有许多控件)。

否则的话,也没有多大关系。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文