从预编译程序集中的资源中检索值 [英] retrieve value from a resource in pre compiled assembly

查看:94
本文介绍了从预编译程序集中的资源中检索值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试从预编译的程序集中的资源中检索文本值(将在页面中内联使用)

在我的另一个更普通的网站(没有预编译的程序集)中,我这样做是这样,并且效果很好;

<% =Resources.my_resource.hello_text%>(内联文本)
<%$ Resources:my_resource, hello_text %>(服务器控件)

在我的预编译程序集中,我有一个资源,但是无法像上面尝试的那样使用上面或下面的内容来检索它,我也尝试了一些变体但没有成功;

<% =Resources.global.my_assembly.my_resource.hello_text%>
<%$ Resources:global.my_assembly.my_resource, hello_text %>

我确实需要能够从页面标记自身访问此内联.我希望能够在没有可能难以集成到站点或编写类来解决此问题的变通方法的情况下进行此工作.

有谁知道如何使它工作?

M:)

Hi

I''m trying to retrieve a text value (to be used inline in page) from a resource in a pre compiled assembly

In my other more normal website (no precompiled assembly) I do it like this and it works fine;

<% =Resources.my_resource.hello_text%> (inline text)
<%$ Resources:my_resource, hello_text %> (server controls)

In my pre compiled assembly I have a resource but cannot retrieve it with either the above or below as I''ve tried, I''ve also tried with some variants but no success;

<% =Resources.global.my_assembly.my_resource.hello_text%>
<%$ Resources:global.my_assembly.my_resource, hello_text %>

I really need to be able to access this inline from the page markup its self. I hope to be able to get this working without a workaround that may be difficult to integrate into the site or writing a class to handle this.

Does anyone know how to get this working?

M:)

推荐答案

资源:my_resource,hello_text%> (服务器控件)

在我的预编译程序集中,我有一个资源,但是无法像上面尝试的那样使用上面或下面的内容来检索它,我也尝试了一些变体但没有成功;

<% =Resources.global.my_assembly.my_resource.hello_text%>
<%
Resources:my_resource, hello_text %> (server controls)

In my pre compiled assembly I have a resource but cannot retrieve it with either the above or below as I''ve tried, I''ve also tried with some variants but no success;

<% =Resources.global.my_assembly.my_resource.hello_text%>
<%


Resources:global.my_assembly.my_resource, hello_text %>

我确实需要能够从页面标记自身访问此内联.我希望能够在没有可能难以集成到站点或编写类来解决此问题的变通方法的情况下进行此工作.

有谁知道如何使它工作?

M:)
Resources:global.my_assembly.my_resource, hello_text %>

I really need to be able to access this inline from the page markup its self. I hope to be able to get this working without a workaround that may be difficult to integrate into the site or writing a class to handle this.

Does anyone know how to get this working?

M:)


您好,

您是否尝试过将访问修饰符从内部更改为公共(在resx编辑器中可用,如果您在解决方案资源管理器中双击resx,则会在窗口顶部找到下拉菜单).

将修饰符更改为public后,我可以在.aspx中使用此代码:

Hello,

Have you tried to change the access modifier from internal to public (available in the resx editor, if you double click your resx in the solution explorer, you will find the dropdown on top of the window).

After changing the modifier to public, I was able to use this code in the .aspx:

<%= WebResourcesTest.MyResfile.HelloWorld %>



希望这对您有所帮助,并且最诚挚, 停止



Hope this helps and best regardy,
Stops


这篇关于从预编译程序集中的资源中检索值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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