后台文件: 复制代码 代码如下: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Xml; using System.Xml.Linq;
public partial class UserControls_SystemVersion : System.Web.UI.UserControl { private const string CON_FilePath = "~/App_Data/sysVersion.xml";
//// <summary> /// 下拉框赋值 /// </summary> public string Value { set { ViewState["Value"] = value; } get { return ViewState["Value"] == null ? null : ViewState["Value"].ToString().Trim(); } }
public void DdlBind() { XElement xDoc = XElement.Load(Server.MapPath(CON_FilePath));
// Create the query var lVersion = from c in xDoc.Descendants("Item") where c.Element("Version_ID").Value == "1" //目前只显示CN select new { Version_Name = c.Element("Version_Name").Value, Version_ID = c.Element("Version_ID").Value };