protected void uiGridViewProducts_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditProduct")
            {
                Product product = new Product();
                product.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument));
                CurrentProduct = product;

                uiTextBoxName.Text = product.Name;
                uiTextBoxCode.Text = product.ProductCode;
                if(!product.IsColumnNull("Price"))
                    uiTextBoxPrice.Text = product.Price.ToString();
                uiFCKeditorDesc.Value = Server.HtmlDecode(product.Description);
                uiDropDownListCategory.SelectedValue = product.CategoryID.ToString();
                if (!product.IsColumnNull("SubCategoryID"))
                    uiDropDownListSubCat.SelectedValue = product.SubCategoryID.ToString();
                uiPanelViewProducts.Visible = false;
                uiPanelEdit.Visible = true;
            }
            else if (e.CommandName == "DeleteProduct")
            {
                try
                {
                    Product product = new Product();
                    product.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument));
                    product.MarkAsDeleted();
                    product.Save();
                    BindData();
                }
                catch (Exception ex)
                {
                    uiLabelError.Visible = true;
                }

            }
        }
 protected void uiDropDownListProducts_SelectedIndexChanged(object sender, EventArgs e)
 {
     Product pro = new Product();
     pro.LoadByPrimaryKey(Convert.ToInt32(uiDropDownListProducts.SelectedValue));
     if(!pro.IsColumnNull("Price"))
         uiTextBoxPrice.Text = pro.Price.ToString();
 }