当前位置: 代码迷 >> 综合 >> C#下拉框
  详细解决方案

C#下拉框

热度:50   发布时间:2024-01-28 05:21:20.0

C#下拉框

先拉一个下拉框

 

<asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="true"><asp:ListItem Selected="True" Value="0">全部</asp:ListItem></asp:DropDownList>

在后台设置要显示的文本和要连接的ID

DropDownList1.DataSource = ProductCategoryManage.select();DropDownList1.DataTextField = "Name";DropDownList1.DataValueField = "Id";DropDownList1.DataBind();

最后记得把绑定数据源删除

 

  相关解决方案