private Product GetSelectedProduct()
    {
        DataView dvProduct = (DataView)SDSProductsDDL.Select(DataSourceSelectArguments.Empty);

        dvProduct.RowFilter = "ProductID = '" + ddlProducts.SelectedValue + "'";
        Product Product = new Product();

        Product.ProductID   = dvProduct[0]["ProductID"].ToString();
        Product.ProductName = dvProduct[0]["ProductName"].ToString();
        Product.ProductDesc = dvProduct[0]["ProductDesc"].ToString();
        Product.ProductSKU  = dvProduct[0]["ProductSKU"].ToString();
        Product.ProductCost = Convert.ToDecimal(dvProduct[0]["ProductCost"]).ToString();
        Product.ImageFile   = dvProduct[0]["Picture"].ToString();

        return(Product);
    }
示例#2
0
    private Product GetSelectedProduct()
    {
        //Retrieves and displays the records binded to the DDL
        DataView dvProduct = (DataView)SDSProductsDDL.Select(DataSourceSelectArguments.Empty);

        //Filters rows in ddlProducts by the ProductID
        dvProduct.RowFilter = "ProductID = '" + ddlProducts.SelectedValue + "'";

        //Instantiates a new product object
        Product Product = new Product();

        // Displays properties of the selected product
        Product.ProductID   = dvProduct[0]["ProductID"].ToString();
        Product.ProductName = dvProduct[0]["ProductName"].ToString();
        Product.ProductDesc = dvProduct[0]["ProductDesc"].ToString();
        Product.ProductSKU  = dvProduct[0]["ProductSKU"].ToString();
        Product.ProductCost = Convert.ToDecimal(dvProduct[0]["ProductCost"]).ToString();
        Product.ImageFile   = dvProduct[0]["Picture"].ToString();

        return(Product);
    }