各位高人,xml里我想他做数据源绑定,并且有条件地,比如“id=1”怎么写?高手帮忙!
各位高人,xml里我想他做数据源绑定,并且有条件地,比如“id=1”怎么写?高手帮忙!
FileStream fs = new FileStream(Server.MapPath("lianxi15.xml"), FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs);
DataSet ds = new DataSet();
ds.ReadXml(sr);
this.xianshi.DataSource = ds.Tables[0];
this.xianshi.DataBind();
------解决方案--------------------
DataView dv = ds.Tables[0].DefaultView;
dv.RowFilter = "id=1";
this.xianshi.DataSource = dv;
this.xianshi.DataBind();