SPList Projectlist = web.Lists["ListA"];
SPQuery queryProjectList = new SPQuery();
queryProjectList.ViewFields = "";
queryProjectList.Query = """;
SPListItemCollection colProjectlist = Projectlist.GetItems(queryProjectList);
dt = colProjectlist.GetDataTable();
foreach (DataRow dr in dt.Rows)
{
DataRow newrow = dtProjectList.NewRow();
try
{
newrow["Project"] = dr["Title"];
newrow["StartDate"] = DateTime.Parse(dr["Rem_StartDate"].ToString()).ToShortDateString();
newrow["EndDate"] = DateTime.Parse(dr["Rem_EndDate"].ToString()).ToShortDateString();
newrow["Category"] = dr["Category"];
dtProjectList.Rows.Add(newrow);
gr.DataSource = dtProjectList;
gr.DataBind();
Controls.Add(gr);
}
|