tio-hashtable.aspx

来自「asp.net1.1入门经典C#.2003」· ASPX 代码 · 共 41 行

ASPX
41
字号
<%@ Page Language="C#" Debug="true" %>
<script runat="server">

    void Page_Load()
    {
    lblShow.Visible = false;
    if (Page.IsPostBack)
    {
      DateTime datDateIn;
      Hashtable hashConcerts = new Hashtable();
      hashConcerts[Convert.ToDateTime("1/3/2005")] = "Bridgemen";
      hashConcerts[Convert.ToDateTime("1/4/2005")] = "Vanguard";
      hashConcerts[Convert.ToDateTime("1/2/2005")] = "Blue Devils";
      hashConcerts[Convert.ToDateTime("1/1/2005")] = "Belevederes";
    
      datDateIn = Convert.ToDateTime(txtDateIn.Text);
      lblShow.Text = "On this date enjoy the: ";
      lblShow.Text += hashConcerts[datDateIn];
      lblShow.Visible = true;
    }   //End if (Page.IsPostBack)
    }   //End  Page_Load

</script>
<html>
<head>
    <title>HashTable Example</title>
</head>
<body>
    <form runat="server">
        <h3>2005 Drum and Bugle Corps Concert 
        </h3>
        Please enter a date between 1/1/2005 and 1/4/2005 
        <asp:TextBox id="txtDateIn" runat="server"></asp:TextBox>
        <br />
        <asp:Button id="Button1" runat="server" Text="Look up"></asp:Button>
        <br />
        <asp:Label id="lblShow" runat="server"></asp:Label>
    </form>
</body>
</html>

⌨️ 快捷键说明

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