protected void uiGridViewDims_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditDim")
            {
                Dimension objData = new Dimension();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxWidth.Text = objData.Width.ToString();
                uiTextBoxHeight.Text = objData.Height.ToString();

                uiPanelAllCats.Visible = false;
                uiPanelEditCat.Visible = true;
                CurrentDim = objData;

                BindDims();
            }
            else if (e.CommandName == "DeleteDim")
            {
                try
                {
                    Dimension objData = new Dimension();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentDim = null;
                    BindDims();
                }
                catch (Exception ex)
                {
                    uipanelError.Visible = true;
                }
            }
        }
        protected void uiGridViewEnvelops_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                System.Web.UI.HtmlControls.HtmlGenericControl div = e.Row.FindControl("ColorDiv") as System.Web.UI.HtmlControls.HtmlGenericControl;

                int Colid = (int)DataBinder.Eval(e.Row.DataItem, "ColorID");
                Color col = new Color();
                col.LoadByPrimaryKey(Colid);

                string color = "#" + col.ColorCode;
                div.Attributes.CssStyle.Add("background-color", color);

                Label dim = (Label)e.Row.FindControl("uiLabelDim");
                int dimid = (int)DataBinder.Eval(e.Row.DataItem, "DimensionID");
                Dimension obj = new Dimension();
                obj.LoadByPrimaryKey(dimid);
                dim.Text = obj.Width.ToString() + " × " + obj.Height.ToString();
            }
        }