WEBSWAPP Silverlight ASP.NET 3.5 ASP.NET 2.0 ASP.NET 1.0
Nested Data
Images
Dynamic Controls
DataGrid DataList Repeater VB-HTMLTable
    
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; namespace WEBSWAPP.Website.CodeSamples.ASPNET1.HierarchicalData { public partial class NestedRepeater : System.Web.UI.UserControl { public int CompanyPrimaryKey { get { int ret = 0; if (ViewState["CompanyPrimaryKey"] != null) ret = (int)ViewState["CompanyPrimaryKey"]; return ret; } set { ViewState["CompanyPrimaryKey"] = value; Repeater_Bind(); } } private void Repeater_Bind() { if (Data_View() != null) { if (Data_View().Count > 0) { ChildList.DataSource = Data_View(); ChildList.DataBind(); } } } private DataView Data_View() { DataView dv = null; DataSet ds = (DataSet)Session["Repeater_ParentChild"]; if (ds != null) { DataView dvParent = new DataView(ds.Tables["Company"], "ID=" + CompanyPrimaryKey, null, System.Data.DataViewRowState.CurrentRows); if (dvParent.Count > 0) dv = dvParent[0].CreateChildView("ParentChild"); } return dv; } } }