对
<asp:ListBox ID="ListBox1" runat="server" Rows="10" Width="200px"></asp:ListBox>
我在Page_Load事件里调用了这个方法添加Item
private void ListTemplate()
    {
        //列出模版目录下的所有文件
        string templatePath="../HTMLTemplet";
        templatePath = Server.MapPath(templatePath) + "\\";
        string[] template;
        //取模版目录下所有文件
        template = Directory.GetFiles(templatePath);
        ListBox1.Items.Clear();
        for(int i=0;i<template.Length;i++)
        {
            template[i] = template[i].Replace(templatePath, "");
            ListItem myli=new ListItem();
            myli.Text = template[i];
            myli.Value=template[i];
            ListBox1.Items.Add(myli);
        }
    }
然后呢,我在点击别的Button的时候,我没法使用ListBox1.SelectedValue.ToString();取值了
解决方法,改用ListBox1.SelectedIndex
ListBox1.Items[ListBox1.SelectedIndex].Value;