result.aspx

来自「C#开发者可使用的经典案例集,源自于ASP.NET经典范例50讲」· ASPX 代码 · 共 36 行

ASPX
36
字号
<html>
  <head>
    <title>Result</title>
    <script runat="server" language="C#">
    void Page_Load()
    {
      // Read score into Hashtable
      Hashtable score = HashFile.ReadHashtableFromFile(Server.MapPath("score.txt"));

      // Read channel into Hashtable
      Hashtable channel = HashFile.ReadHashtableFromFile(Server.MapPath("channel.txt"));

      foreach(object s in channel.Keys)
      {
        if(score[(string)s] == null)
        {
          result.Items.Add((string)channel[s] + ":0");
        }
        else
        {
        result.Items.Add((string)channel[s] + ":" + (string)score[(string)s]);
        }
      }
    }
    </script>
  </head>

  <body>
    <h3>谢谢参与,当前的评选结果为</h3>
    <form id="form2" runat="server">
      <asp:ListBox id="result" width="100" 
                   rows="10" runat="server" />
    </form>
  </body>
</html>

⌨️ 快捷键说明

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