Package_Name HolidayId Holiday_ID Holiday_Description Holiday_Date
Package1712200466 8,29,5 1 New Years Day 2013-01-01 00:00:00.000
Package1712200466 8,29,5 3 Holi 2013-04-27 00:00:00.000
Package1712200466 8,29,5 4 Memorial Day 2013-05-27 00:00:00.000
Package1712200466 8,29,5 5 US Independence Day 2013-07-04 00:00:00.000
Package1712200466 8,29,5 29 Independence Day 2013-08-15 00:00:00.000
Package1366323919 5,4,3 1 New Years Day 2013-01-01 00:00:00.000
Package1366323919 5,4,3 3 Holi 2013-04-27 00:00:00.000
Package1366323919 5,4,3 4 Memorial Day 2013-05-27 00:00:00.000
Package1366323919 5,4,3 5 US Independence Day 2013-07-04 00:00:00.000
Package1366323919 5,4,3 29 Independence Day 2013-08-15 00:00:00.000
我正在构建一个嵌套的 Gridview 格式
Package1712200466
Holiday_ID Holiday_Description Holiday_Date
1 New Years Day 2013-01-01 00:00:00.000
5 US Independence Day 2013-07-04 00:00:00.000
29 Independence Day 2013-08-15 00:00:00.000
Package1366323919
Holiday_ID Holiday_Description Holiday_Date
1 New Years Day 2013-01-01 00:00:00.000
3 Holi 2013-04-27 00:00:00.000
4 Memorial Day - Last Monday 2013-05-27 00:00:00.000
5 US Independence Day 2013-07-04 00:00:00.000
29 Independence Day 2013-08-15 00:00:00.000
整体数据:
SELECT Pac.Package_Name, Pac.HolidayId,Hol.Holiday_ID,Hol.Holiday_Description,Hol.Holiday_Date from tblPackage Pac, tblHoliday Hol WHERE Hol.Holiday_ID IN ('5','29','1','4','3')
我通过以下查询获得了两个包名称:
string sSql = "SELECT Pac.Package_Name, Pac.HolidayId,Hol.Holiday_ID,Hol.Holiday_Description,Hol.Holiday_Date from tblPackage Pac, tblHoliday Hol WHERE Hol.Holiday_ID IN (" + data + ")";
dsPackage = bsl.ExecuteReaderQry(sSql);
dsPac = dsPackage.Tables[0];
var distinctValues = dsPac.AsEnumerable()
.Select(row => new
{
Package_Name = row.Field<string>("Package_Name"),
})
.Distinct();
Package1712200466
Package1366323919
如上所述,我如何获得 Gridview 的格式
我正在尝试RowDataBound
在外部网格中使用以下查询
GridView gvHolidayPackages = (GridView)e.Row.FindControl("gvHolidayPackages");
if (gvHolidayPackages != null)
{
Label lblPackageName = (Label)e.Row.FindControl("lblPackageName");
var results = from myRow in dsPac.AsEnumerable()
where myRow.Field<string>("Package_Name").Equals(lblPackageName.Text)
select myRow;
gvHolidayPackages.DataSource = results;
gvHolidayPackages.DataBind();
}