过滤XML后绑定GridView问题
<Car>
<user id= "1 ">
<product id= "21 ">
<P_Name> 低合金 </P_Name>
<productAgora> 3.00 </productAgora>
<productUser> 2.400 </productUser>
<productNum> 12 </productNum>
</product>
</user>
<user id= "3 ">
<product id= "22 ">
<P_Name> 低合金 </P_Name>
<productAgora> 5.00 </productAgora>
<productUser> 4.250 </productUser>
<productNum> 100 </productNum>
</product>
</user>
<user id= "2 ">
<product id= "22 ">
<P_Name> 低合金 </P_Name>
<productAgora> 5.00 </productAgora>
<productUser> 4.250 </productUser>
<productNum> 1 </productNum>
</product>
</user>
</Car>
上面是XML文档
ASP。NET代码:
DataSet ds = new DataSet();
ds.ReadXml( "Car.xml ");
decimal productAgora = 0;
decimal productUser = 0;
int productNum = 0;
//过滤XML
DataTable dt = ds.Tables[ "product "];
DataView dv = dt.Copy().DefaultView;
dv.RowFilter = " user_Id= " + Session[ "UserID "].ToString();
gvCar.DataSource = dv;
gvCar.DataBind();
我的需求是字段user_Id为XML节点user属性可是绑定的时间字段的值是从0开始而不是节点user的属性id的值
------解决方案--------------------具体参见这个
http://blog.csdn.net/kgdiwss/archive/2005/09/07/474121.aspx
------解决方案--------------------
C# code
/// <summary>
/// 读取Xml返回一个经排序或筛选后的DataView
/// </summary>
/// <param name="strXmlPath"></param>
/// <param name="strWh