Esempio n. 1
0
    protected void Suppliers_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (Suppliers.SelectedValue == "-1")
        {
            // The "Show/Edit ALL" option has been selected
            SupplierDetails.DataSourceID = "AllSuppliersDataSource";

            // Reset the page index to show the first record
            SupplierDetails.PageIndex = 0;
        }
        else
        {
            // The user picked a particular supplier
            SupplierDetails.DataSourceID = "SingleSupplierDataSource";
        }

        // Ensure that the DetailsView and GridView are in read-only mode
        SupplierDetails.ChangeMode(DetailsViewMode.ReadOnly);
        ProductsBySupplier.EditIndex = -1;

        // Need to "refresh" the DetailsView
        SupplierDetails.DataBind();
    }