如何根据表中增加的公司数量在Web表单中动态创建Gridview [英] How I Can Create Gridview Dynamically In Web Form Acccording To Number Of Companyid In Increase In Table
问题描述
我如何根据条件显示数据分离Gridview,
我的意思是在表格中我有价值
< pre lang =sql> - ----------------- -------------------------------------------
CompanyID | BranchID | EmployeeID | EmployeeName
- ------------------- -----------------------------------------
< span class =code-digit> 1 | 1 | 1 | Arvind |
1 | 1 | 2 | Ajay |
1 | 3 | 3 | Sonu |
1 | 2 | 4 | Vinod |
1 | 1 | 5 |塔伦|
1 | 2 | 6 | Uddhav |
2 | 2 | 7 |拉维|
2 | 1 | 8 | Govinda |
2 | 2 | 9 |罗宾|
2 | 2 | 10 | Anand |
这里CompanyID是1和2然后两个GridView必须显示在WebForm上
如何根据CompanyID获得此数据的输出,
例如dinstinct(CompanyID)为1,2,3及更多
如果CompanyID的数量增加了我如何增加Gridview的数量?
var distinctCompanyIds = datatable.AsEnumerable()
.Select(s = > new {
id = s.Field< string>( CompanyId),
})
.Distinct()。ToList();
现在计算distinctCompanyIds
并动态创建该数量的GridViews
。
How i can separate Gridview according to condition display data,
what i means is that in table i have value like
-------------------------------------------------------------- CompanyID | BranchID | EmployeeID | EmployeeName -------------------------------------------------------------- 1 | 1 | 1 | Arvind | 1 | 1 | 2 | Ajay | 1 | 3 | 3 | Sonu | 1 | 2 | 4 | Vinod | 1 | 1 | 5 | Tarun | 1 | 2 | 6 | Uddhav | 2 | 2 | 7 | Ravi | 2 | 1 | 8 | Govinda | 2 | 2 | 9 | Robin | 2 | 2 | 10 | Anand |
here CompanyID is 1 and 2 then two GridView must display on WebForm
how i can get output of this data according to CompanyID,
e.g dinstinct(CompanyID) is 1 , 2 , 3 and more
if Number of CompanyID increases how i can increase the number of Gridview ??解决方案var distinctCompanyIds = datatable.AsEnumerable() .Select(s=> new { id = s.Field<string>("CompanyId"), }) .Distinct().ToList();
Now count thedistinctCompanyIds
and dynamically create that number ofGridViews
.
这篇关于如何根据表中增加的公司数量在Web表单中动态创建Gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!