在asp:label中使用嵌入的字符串(resource.dll) [英] using embedded strings (resource.dll) inside asp:label

查看:138
本文介绍了在asp:label中使用嵌入的字符串(resource.dll)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个asp.net项目,其中包含大量的Webside.这些webside中的许多aspx/ascx都由以下几行组成:

Hi,

I have a asp.net project with tons of websides. Many of these websides aspx/ascx consists of lines like this:

<asp:Label ID="ID_ALERT" runat="server" Text="Alerts" meta:resourcekey="res_NAVI_ALERTS"></asp:Label>



在所有资源中,所有Al都可以在App_LocalResources目录下正确找到.

然后,我已将构建动作从所有资源(从内容资源)更改为嵌入资源.
我现在看到的是在bin文件夹下创建了新目录,例如fr代表法语,等等.在这些目录中,我可以看到* resource.dlls.

我现在的问题是如何使上面的asp:lable可以利用我创建的资源dll?据我所知,该机制仍然取决于App_LocalResources目录下的resx文件.

我知道以下机制可以正常工作,例如



Al in all the resources are found correctly under the App_LocalResources directory.

I then have changed the build action from all the resource from content to embedded resource.
What I saw now is that new directories under the bin folder are created like fr for french etc. Inside these directories I can see the *resource.dlls.

My question now is how can I make the asp:lable above to make use of the resource dll I have created? As far as I can see the mechanism still depends of the resx files under App_LocalResources directory.

I know that the below mechanism would work e.g.

<a href=''/my/About.aspx''>my Default<%=myNameSpace.GlobalResMgr.GetString("my_menu","my_res101")%></a><img width=''8'' height=''18'' alt='''' src=''/my/images/header_divider.png''/>


这意味着定义一个私有方法来获取资源.此机制也适用于dll资源.

但是在这些asp:lables中没有利用资源dll的窍门吗?

在此先感谢
Achim


That means defining a private methode to pick up the resources. This mechanism will also work for dll resources.

But isnt there a trick to make use of resource dll''s inside these asp:lables?

Thanks in advance
Achim

推荐答案

您是否研究过资源表达式生成器语法?

]]>

http://www.123aspx.com/redir.aspx?res=35521 [ ^ ]
Have you looked into the Resource Expression Builder Syntax?

]]>

http://www.123aspx.com/redir.aspx?res=35521[^]


感谢答复.我研究了表达式构建器语法.
我认为可以创建自己的资源表达式生成器并从资源dll中读取.

我不喜欢的是,当将aspx切换到设计器视图时,没有显示默认文本.还有办法吗?
由于显示了默认文本,因此以下行在设计器视图中运行良好.
thanks for the reply. I have looked into the expression builder syntax.
I think its possible to create my own resource expression builder and read from the resource dll.

What I dont like is that when switching the aspx to designer view there is no default text displayed. Is there a way to do this also?
The below line is working well in designer view, since the default text is displayed.
<asp:Label ID="ID_ALERT" runat="server" Text="Alerts" meta:resourcekey="res_NAVI_ALERTS"></asp:Label>


这篇关于在asp:label中使用嵌入的字符串(resource.dll)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆