public partial class Controls_SectionIndex : System.Web.UI.UserControl
{
    private NBearLite.Database Db = NBearLite.Database.Default;

    protected void Page_Load(object sender, EventArgs e)
    {
        int sectionType = Convert.ToInt32(Request.QueryString["sectiontype"]);
        rep.DataSource = ListIndex(sectionType, 0);
        rep.DataBind();

    }


    public IEnumerable<GHSection> ListIndex(int sectionType, int parentID)
    {
        List<SqlGHSection> list = Db.Select(Tables.GHSection)
            .Where(Tables.GHSection.SectionType == sectionType && Tables.GHSection.ParentID == parentID)
            .OrderBy(Tables.GHSection.ID.Asc)
            .ToList<SqlGHSection>();
        foreach (GHSection node in list)
        {
            yield return node;
            foreach (GHSection node3 in ListIndex(sectionType, node.ID))
            {
                yield return node3;
            }

        }
    }
}

相关文章:

  • 2022-12-23
  • 2022-03-09
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2021-06-25
  • 2019-03-09
  • 2021-10-11
猜你喜欢
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-06-17
相关资源
相似解决方案