0
這裏的LIGNE:IIF返回的ressource變量
<%# IIf(Container.DataItem("OldAdress") = Container.DataItem("NewAdress"), "", "Adress")%>
而不是硬編碼「住址」,我想回到一個資源變量。可能嗎 ?
這裏的LIGNE:IIF返回的ressource變量
<%# IIf(Container.DataItem("OldAdress") = Container.DataItem("NewAdress"), "", "Adress")%>
而不是硬編碼「住址」,我想回到一個資源變量。可能嗎 ?
通過使用GetGlobalResourceObject/GetLocalResource對象函數。從 https://msdn.microsoft.com/en-us/library/ms227982(v=vs.140).aspx
C#:
<%@ Page Language="C#" %>
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
Button1.Text =
GetLocalResourceObject("Button1.Text").ToString();
Image1.ImageUrl =
(String)GetGlobalResourceObject(
"WebResourcesGlobal", "LogoUrl");
Image1.Visible = true;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click"
Text="Get Resources" />
<asp:Image ID="Image1" runat="server"
Visible="false" />
</div>
</form>
</body>
</html>
VB.Net:
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Button1_Click(_
ByVal sender As Object, ByVal e As System.EventArgs)
Button1.Text = _
GetLocalResourceObject("Button1.Text").ToString()
Image1.ImageUrl = _
CType(GetGlobalResourceObject("WebResourcesGlobal", _
"LogoUrl"), String)
Image1.Visible = True
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click"
Text="Get Resources" />
<asp:Image ID="Image1" runat="server"
Visible="false" />
</div>
</form>
</body>
</html>