0

嗨,我有一个 ASPX 项目符号列表控件

                <asp:BulletedList id="blProductsBulletedList" 
                BulletStyle="Disc"
                DataTextField="CheckListsFriendlyName"
                runat="server">                    
            </asp:BulletedList>

我在页面加载中绑定了一个单列数据表:

            string strSQLQuery = "SELECT [CheckListsFriendlyName] FROM [SingleEnded2].[dbo].[WOCFriendlyNames]";
        // Run the query and bind the resulting DataSet
        // to the GridView control.
        DataTable dt = getCheckListExampleList(strSQLQuery);
        if (dt.Rows.Count > 0)
        {
            blProductsBulletedList.DataSource = dt;
            blProductsBulletedList.DataBind();
        }

        }

在 cs 文件的更下方是“getCheckListExampleList()”:

        DataTable getCheckListExampleList(string strSQLQuery)
    {
        SqlConnection seConnection = new SqlConnection(Databases.getDbConnectionString("csSingleEnded2"));
        DataTable dt = new DataTable();
        SqlCommand seCmd = new SqlCommand(strSQLQuery, seConnection);
        try
        {
            SqlDataAdapter sda = new SqlDataAdapter();
            seCmd.Connection = seConnection;
            sda.SelectCommand = seCmd;
            sda.Fill(dt);
        }
        catch (Exception ex){
            // The connection failed. Display an error message.
            throw new Exception("Unable to connect to the database", ex);
        }
        return dt;
      }

这可行,但是该列表不会出现项目符号,而只是看起来好像它只是记录的视图。谁能指出我正确的方向,将每个结果显示为项目符号列表项,并且在 X 数量的结果之后添加标题以将结果分成多个部分?

4

0 回答 0