我正在开发一个控件,它允许我在页面上为占位符指定大小。使用各种数据表的控件变得非常复杂。
我想让创建布局的过程尽可能自动化。
我要做的是根据从数据表中提取的值生成一些gridview行。
到目前为止,这是我的代码
List<GridData> Grids = new List<GridData>();
Grids.Add(new GridData { Size = 1, Title = "Grid_1" });
Grids.Add(new GridData { Size = 2, Title = "Grid_2" });
Grids.Add(new GridData { Size = 3, Title = "Grid_3" });
Grids.Add(new GridData { Size = 4, Title = "Grid_4" });
Grids.Add(new GridData { Size = 5, Title = "Grid_5" });
Grids.Add(new GridData { Size = 6, Title = "Grid_6" });
Grids.Add(new GridData { Size = 7, Title = "Grid_7" });
Grids.Add(new GridData { Size = 8, Title = "Grid_8" });
Grids.Add(new GridData { Size = 9, Title = "Grid_9" });
Grids.Add(new GridData { Size = 10, Title = "Grid_10" });
Grids.Add(new GridData { Size = 11, Title = "Grid_11" });
Grids.Add(new GridData { Size = 12, Title = "Grid_12" });
GV_PlaceHolders.DataSource = from x in db.DT_Layouts2s
where x.LayoutID == int.Parse(DDL_Layouts.SelectedValue.ToString())
select new
{
x.LayoutID,
x.PlaceHolders,
Grids,
};
GV_PlaceHolders.DataBind();
现在我想要生成行的方法是调用占位符int值,但我不知道哪里开始基于值生成动态行。
有人能指出我正确的方向吗?
干杯