2 回答
TA贡献1805条经验 获得超10个赞
选择条件(要查询的姓名):
<asp:DropDownList ID="DdlSelectWhere" runat="server" AutoPostBack="true"
onselectedindexchanged="DdlSelectWhere_SelectedIndexChanged">
<asp:ListItem Text="姓名A" Value="NameA"></asp:ListItem>
<asp:ListItem Text="姓名B" Value="NameB"></asp:ListItem>
</asp:DropDownList>
查询出来的结果:
<asp:DropDownList ID="DdlSelectNames" runat="server" DataTextField="Name" DataValueField="ID">
</asp:DropDownList>
后台绑定:
protected void DdlSelectWhere_SelectedIndexChanged(object sender, EventArgs e)
{
DataTable dtTemp = DbOperator.GetDt("Select ID,Name From TableA Where Name='"+DdlSelectWhere.SelectedValue+"'");//根据条件获取数据,使用你的方式查找,只是举例。
DdlSelectNames.DataSource = dtTemp;
DdlSelectNames.DataBind();
}
- 2 回答
- 0 关注
- 636 浏览
添加回答
举报