单个属性 | Customer: <%# custID %> |
集合 Orders | <asp:ListBox id="List1" datasource=''<%# myArray %>'' runat="server"> |
表达式 Contact | <%# ( customer.FirstName + " " + customer.LastName ) %> |
方法的返回值 | Outstanding Balance: <%# GetBalance(custID) %> |
Number of Records: <%# count.ToString() %> |
<script language="VB" runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Page.DataBind End Sub ReadOnly Property custID() As String Get Return "ALFKI" End Get End Property ReadOnly Property orderCount() As Integer Get Return 11 End Get End Property </script> <form action="DataBind1_vb.aspx" runat="server"> Customer: <b><%# custID %></b><br /> Open Orders: <b><%# orderCount %></b> </form> |
<asp:DropDownList id="StateList" runat="server"> <asp:ListItem>CA</asp:ListItem> …… </asp:DropDownList> <asp:button ID="Button1" Text="Submit" OnClick="SubmitBtn_Click" runat="server"/> Selected State: <asp:label ID="Label1" text=''<%# StateList.SelectedItem.Text %>'' runat="server"/> |