日期:2014-05-18 浏览次数:20500 次
<tr> <td> 请选择主机厂:<asp:DropDownList ID="ddlCustomer" runat="server" OnSelectedIndexChanged="ddlCustomer_changed"> </asp:DropDownList> </td> </tr> <tr> <td> <asp:ListView ID="ListView1" runat="server" DataKeyNames="productid"> <AlternatingItemTemplate> ........................................
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.Orders orders=new BLL.Orders(); ddlCustomer.DataSource = orders.getCustomersDataSet(); ddlCustomer.DataValueField = "customerid"; ddlCustomer.DataTextField = "name"; ddlCustomer.DataBind(); ListView1.DataSource = orders.getProductsDataSetByCustomerId(int.Parse(ddlCustomer.SelectedValue)); ListView1.DataBind(); } } protected void ddlCustomer_changed(object sender, EventArgs e) { BLL.Orders orders = new BLL.Orders(); ListView1.DataSource = orders.getProductsDataSetByCustomerId(int.Parse(ddlCustomer.SelectedValue)); ListView1.DataBind(); }