DataTable dtGridView = new DataTable();
ViewState.Add("TempList", dtGridView);
dtGridView.Columns.Add("SourceWareHouse", typeof(string));
dtGridView.Columns.Add("DestWareHouse", typeof(string));
dtGridView.Columns.Add("Others", typeof(string)); for (int i = 0; i < dt.Rows.Count; i++)
{
string strSourceWareHourse = dt.Rows[i][1].ToString();
string strDestWareHourse = dt.Rows[i][2].ToString();
string strCostsIds = dt.Rows[i][3].ToString();
string[] ary = strCostsIds.Split('|');
int intCostsUnitPriceTable = Convert.ToInt32(ary[0]);
int CostsUnitPriceId = Convert.ToInt32(ary[1]); DataTable dtt = (DataTable)ViewState["TempList"];
DataRow dtGridViewRC =dtt.Rows;
object[] rowVals = new Object[3];
rowVals[0] = strSourceWareHourse;
rowVals[1] = strDestWareHourse; if (intCostsUnitPriceTable == 1)
{
DataTable dt1 = price1Table.GetPrice1ByCostsUnitPriceId(CostsUnitPriceId);
string strOthers = "起运地:" + dt1.Rows[i]["FromCityAreaName"].ToString() + "\\n" +
"到达地:" + dt1.Rows[i]["ToCityAreaName"].ToString() + "\\n" ";
rowVals[2] = strOthers;
}
else if (intCostsUnitPriceTable == 2)
{
}
dtGridViewRC.Add(rowVals);
ViewState["TempList"] = dtt; }
GridView1.DataSource = dtGridView;
GridView1.DataBind();
ViewState.Add("TempList", dtGridView);
dtGridView.Columns.Add("SourceWareHouse", typeof(string));
dtGridView.Columns.Add("DestWareHouse", typeof(string));
dtGridView.Columns.Add("Others", typeof(string)); for (int i = 0; i < dt.Rows.Count; i++)
{
string strSourceWareHourse = dt.Rows[i][1].ToString();
string strDestWareHourse = dt.Rows[i][2].ToString();
string strCostsIds = dt.Rows[i][3].ToString();
string[] ary = strCostsIds.Split('|');
int intCostsUnitPriceTable = Convert.ToInt32(ary[0]);
int CostsUnitPriceId = Convert.ToInt32(ary[1]); DataTable dtt = (DataTable)ViewState["TempList"];
DataRow dtGridViewRC =dtt.Rows;
object[] rowVals = new Object[3];
rowVals[0] = strSourceWareHourse;
rowVals[1] = strDestWareHourse; if (intCostsUnitPriceTable == 1)
{
DataTable dt1 = price1Table.GetPrice1ByCostsUnitPriceId(CostsUnitPriceId);
string strOthers = "起运地:" + dt1.Rows[i]["FromCityAreaName"].ToString() + "\\n" +
"到达地:" + dt1.Rows[i]["ToCityAreaName"].ToString() + "\\n" ";
rowVals[2] = strOthers;
}
else if (intCostsUnitPriceTable == 2)
{
}
dtGridViewRC.Add(rowVals);
ViewState["TempList"] = dtt; }
GridView1.DataSource = dtGridView;
GridView1.DataBind();
解决方案 »
- 请教高手:访问网页的时候弹出CGI窗口,C# webbrowser如何捕获并且自动登录
- WebBrowser的Navigate重定向时如何阻止/屏蔽弹出“保存对话框”
- 我用c#调用c++写的一个dll,遇到函数的参数是wstring
- 请教AT和TAPI直接有什么区别。谢谢!另能帮贴一段TAPI来电显示的代码吗?
- c#连接Access数据库遇到的问题?
- 我们是做DELPHI的,公司是网络公司,老板今天要我们转NET,问有哪些比较好的资源的.net网站
- winform如何远程获取网站登陆窗口控件
- 查询传值,刷新列表问题(winform,c#),请兄弟们帮忙~
- C#实现两个WinForm间的传值
- dataGrid1的小问题
- 请问高手:如何实现类似csdn左边的树形结构,动态加载子节点
- 求助一个关于IP范围判断的程序,在线等
dtGridView.Columns.Add("SourceWareHouse", typeof(string));
dtGridView.Columns.Add("DestWareHouse", typeof(string));
dtGridView.Columns.Add("Others", typeof(string)); for (int i = 0; i < dt.Rows.Count; i++)
{
string strSourceWareHourse = dt.Rows[i][1].ToString();
string strDestWareHourse = dt.Rows[i][2].ToString();
string strCostsIds = dt.Rows[i][3].ToString();
string[] ary = strCostsIds.Split('|');
int intCostsUnitPriceTable = Convert.ToInt32(ary[0]);
int CostsUnitPriceId = Convert.ToInt32(ary[1]); DataRow dtGridViewRC =dtGridView.NewRow();
dtGridViewRC[0] = strSourceWareHourse;
dtGridViewRC[1] = strDestWareHourse; if (intCostsUnitPriceTable == 1)
{
DataTable dt1 = price1Table.GetPrice1ByCostsUnitPriceId(CostsUnitPriceId);
string strOthers = "起运地:" + dt1.Rows[i]["FromCityAreaName"].ToString() + "\\n" +
"到达地:" + dt1.Rows[i]["ToCityAreaName"].ToString() + "\\n" ";
dtGridViewRC[2] = strOthers;
}
else if (intCostsUnitPriceTable == 2)
{
}
dtGridView.Rows.Add(dtGridViewRC);
}
GridView1.DataSource = dtGridView;
GridView1.DataBind();