コード例 #1
0
    protected void LoadDropDownListProducts()
    {
        ProductsCS prod = new ProductsCS();

        DropDownListProducts.DataSource     = prod.GetProducts();
        DropDownListProducts.DataValueField = "ProductID";
        DropDownListProducts.DataTextField  = "ProductName";

        DropDownListProducts.DataBind();
    }
コード例 #2
0
    protected void ButtonSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            ProductsCS NewProd = new ProductsCS();
            NewProd.AddNewProduct(TextBoxProductName.Text,
                                  Convert.ToInt32(DropDownListSuppliers.SelectedItem.Value),
                                  Convert.ToInt32(DropDownListCategories.SelectedItem.Value),
                                  TextBoxQuantityPerUnit.Text,
                                  Convert.ToDecimal(TextBoxUnitPrice.Text));

            PanelFormInsert.Visible  = false;
            PanelUserMessage.Visible = true;
        }
        catch (Exception ex)
        {
            LabelErrorMessage.Text = ex.Message.ToString();
        }
    }