⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bindingtosimpleproperties.aspx

📁 这是《ASP.NET编程实作教程》一书中的源文件 如果有此书的朋友不防下载过来参考
💻 ASPX
字号:
<html>
<head>
    <script language="C#" runat="server">

        void SubmitBtn_Click(Object sender, EventArgs e) {
        
          // Rather than explictly pull out the variable from the "StateList"
          // and then manipulate a label control, just call "Page.DataBind".
          // This will evaluate any <%# %> expressions within the page
          
          Page.DataBind();
        }

    </script>

</head>
<body>

    <h3><font face="Verdana">DataBinding to a property of another server control</font></h3>

    <form runat=server>

        <asp:DropDownList id="StateList" runat="server">
          <asp:ListItem>CA</asp:ListItem>
          <asp:ListItem>IN</asp:ListItem>
          <asp:ListItem>KS</asp:ListItem>
          <asp:ListItem>MD</asp:ListItem>
          <asp:ListItem>MI</asp:ListItem>
          <asp:ListItem>OR</asp:ListItem>
          <asp:ListItem>TN</asp:ListItem>
          <asp:ListItem>UT</asp:ListItem>
        </asp:DropDownList>
        
        <asp:button Text="Submit" OnClick="SubmitBtn_Click" runat=server/>
        
        <p>
        
        Selected State: <asp:label text='<%# StateList.SelectedItem.Text %>' runat=server/>
        
    </form>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -