こんにちは、ASP.NET の DropDownList に XDocument オブジェクトを含めたいと考えています。
私の ASPX:
<asp:DropDownList ID="drpLogLocation" runat="server" AutoPostBack=true onselectedindexchanged="drpLogLocation_SelectedIndexChanged">
私のC#コード:
XDocument x = XDocument.Load(Server.MapPath(@"~\App_Data\location.xml"));
x.Root.Descendants()
.Where(e => !ActiveUserList.Contains((string)e.Attribute("group")))
.ToList()
.ForEach(s => s.Remove());
drpLogLocation.DataSource = x;// ?????????????
drpLogLocation.DataBind();
ここに私のXML構造:
<plants>
<plant id="DB" display="Dill" group="NPS_DB" />
<plant id="SB" display="Süd" group="NPS_SB" />
</plants>
DropDownList DataTextField="display" と DataValueField="id" が必要です。どうすればこれを行うことができますか