这是我的下拉选择框,带有连接列。如何检索记录的ID并将该值传递给change?
<asp:DropDownList
ID="DropDownList2"
runat="server"
DataSourceID="AccessDataSource1"
DataTextField="Expr1"
DataValueField="Expr1">
</asp:DropDownList>
<asp:AccessDataSource
ID="AccessDataSource1"
runat="server"
DataFile="~/tools/tracker/Tracker.mdb"
SelectCommand="SELECT PAcronym + ' - ' + Milestone + ' (' + PRelease + ')' AS Expr1 FROM Projects ORDER BY PAcronym + ' - ' + Milestone + ' (' + PRelease + ')' ">
</asp:AccessDataSource>
答案 0 :(得分:2)
在查询中选择ID,然后DataValueField="ID"
。然后,您就可以访问值OnSelectedIndexChanged
。它将存储在DropDownList2.SelectedValue
。