3
我想有這段代碼在我的.aspx文件:使用資源作爲屬性的HTML元素在ASP.net
<input class="ms-ButtonHeightWidth" type="button" name="BtnOK" id="Button2"
value="Close"
onclick="javascript:HandleOKButtonClick()"
accesskey="<%$Resources:wss,okbutton_accesskey%>" />
不幸的是,ASP.net似乎並不喜歡即:
An error occurred during the processing of /_layouts/MyPage/Info.aspx.
Literal expressions like '<%$Resources:wss,okbutton_accesskey%>' are not allowed.
Use <asp:Literal runat="server" Text="<%$Resources:wss,okbutton_accesskey%>" />
instead
這並不在這種情況下上班,這將意味着嵌套accesskey屬性,這會導致的引號之間的文字「標籤包含重複的‘ID’屬性」的錯誤。
有沒有辦法從資源中使用字符串,而不必將輸入更改爲asp:Button?我想必須有使用<%=
的方法,但我不知道如何解決資源本身?