如题
<asp:DropDownList ID="dl_ownername" runat="server" DataSourceID="SqlDataSource2"
DataTextField="ownername" DataValueField="ownername">
<asp:ListItem Value="%">全部</asp:ListItem>
</asp:DropDownList>没有显示手动加的项
<asp:DropDownList ID="dl_ownername" runat="server" DataSourceID="SqlDataSource2"
DataTextField="ownername" DataValueField="ownername">
<asp:ListItem Value="%">全部</asp:ListItem>
</asp:DropDownList>没有显示手动加的项
设置这个属性
ds=SqlHelper.ExecuteDataset("proc_GetName");
this.DropDownList1.DataSource=ds;
this.DropDownList1.DataTextField=ds.Tables[0].Columns["Name"].ToString(); this.DropDownList1.DataValueField=ds.Tables[0].Columns["NameID"].ToString();
this.DropDownList1.DataBind();
this.DropDownList1.Items.Insert(0,"请选择");