ASP.Net/Data Binding/Property Binding
Версия от 15:30, 26 мая 2010; (обсуждение)
Color Property binding
<%@ Page Language="VB" %>
<html>
<head>
<title>Simple DataBinding Example</title>
<script runat="server">
Dim FontColor As String
Sub Page_Load()
FontColor = "Red"
DataBind()
End Sub
</script>
</head>
<body>
<h1>Simple DataBinding Example</h1>
The value for FontColor is
<font color="<%# FontColor %>"><%# FontColor %></font>.
</body>
</html>
DataBind method example
<%@ Page Language="vb" %>
<html>
<head>
<title>DataBind method example</title>
<script runat="server">
Dim Color As System.Drawing.Color = System.Drawing.Color.Red
Sub Page_Load()
Message.Text = "ForeColor is: " & Color.Name
DataBind()
End Sub
</script>
</head>
<body>
<asp:label id="Message" ForeColor="<%# Color %>" runat="server"/>
</body>
</html>