开发者

ASP.NET - meta:ResourceKey vs <%$ Resources:MyKey %>

开发者 https://www.devze.com 2023-01-05 19:30 出处:网络
what\'s the difference between assigning text to a Label using meta:ResourceKey a开发者_开发技巧nd

what's the difference between assigning text to a Label using meta:ResourceKey a开发者_开发技巧nd Text="<%$ Resources:MyKey %>". i get the same results using both methods.


The first form is called an implicit resource expression, the second form is an explicit resource expression.

They may give the same result for a single property. However, the implicit meta:ResourceKey has some advantages in that if there are several resourced property definitions in the local resource file, all of them will be applied with just that single declaration. The disadvantage is that it has to be from the "local" resource file, i.e. the resource file for that page.

If you use the explicit property assignment of Text="<%$ Resources:MyKey %>", you'll need to add that code for every property value you want to fetch from the resource file. However, the advantage is that you can specify a filename parameter and fetch the resource from a global resource file.

Here's a reference.

0

精彩评论

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

关注公众号