protected void Page_Load(object sender, System.EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //1) Load SomeDatatable from Database somehow
            // Just for testing : replace with query to DB
            SomeDatatable = new DataTable("x");
            SomeDatatable.Columns.Add(new DataColumn("ContentIndex", Type.GetType("System.Int32")));
            SomeDatatable.Columns.Add(new DataColumn("Name", Type.GetType("System.String")));
            for (int x = 1; x <= 50; x++)
            {
                SomeDatatable.Rows.Add(new object[] {
                    x,
                    "Content " + x
                });
            }
            ///////////////////

            //2) Create a dummy data source for the tab repeater using a list of anonymous types
            List <object> TabList = new List <object>();


            for (int I = 0; I < Math.Ceiling((decimal)SomeDatatable.Rows.Count / (decimal)ContentPerTab); I++)
            {
                TabList.Add(new { TabIndex = I });
            }

            TabRepeater.ItemDataBound += TabRepeater_ItemDataBound;
            TabRepeater.DataSource     = TabList;
            TabRepeater.DataBind();

            TablLinkRepeater.DataSource = TabList;
            TablLinkRepeater.DataBind();
        }
    }
Пример #2
0
        public void Populate()
        {
            LoadData();

            TabRepeater.DataSource = tabs;
            TabRepeater.DataBind();

            TabEditHolder.Visible = false;
            TabListHolder.Visible = true;
        }