使用服务器端资源字符串的Html输入标记

时间:2022-05-08 15:24:04

I have an input button on an ASP.NET form, but I want the text displayed to come from a server side resource file.

我在ASP上有一个输入按钮。NET表单,但是我希望显示的文本来自服务器端资源文件。

The following syntax fails, and I can't enclose it in a literal because the input tag cannot contain any other tags:

下面的语法失败了,我不能将它包含在文字中,因为输入标记不能包含任何其他标记:

 <input id="btnX" type="button" disabled="disabled" value='<%$Resources:res,Button.Text%>' />

Any possible solutions?

任何可能的解决方案?

Thanks :)

谢谢:)

3 个解决方案

#1


2  

What about <%= function %> ?

<%=函数%>呢?

#2


5  

I would think apocalypse's answer should work:

我认为天启的答案应该行得通:

<%= GetLocalResourceObject("Button.Text") %>

or

<%= GetGlobalResourceObject("res", "Button.Text") %>

#3


4  

It will work if you add runat="server" to the input tag.

如果您将runat="server"添加到输入标记,它将会工作。

#1


2  

What about <%= function %> ?

<%=函数%>呢?

#2


5  

I would think apocalypse's answer should work:

我认为天启的答案应该行得通:

<%= GetLocalResourceObject("Button.Text") %>

or

<%= GetGlobalResourceObject("res", "Button.Text") %>

#3


4  

It will work if you add runat="server" to the input tag.

如果您将runat="server"添加到输入标记,它将会工作。