protected void uiGridViewColors_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditColor")
            {
                Color objData = new Color();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxEnName.Text = objData.ColorNameEng;
                uiTextBoxArName.Text = objData.ColorNameAr;
                uiTextBoxColorCode.Text = objData.ColorCode;
                uiPanelAllCats.Visible = false;
                uiPanelEditCat.Visible = true;
                CurrentColor = objData;

                BindColors();
            }
            else if (e.CommandName == "DeleteColor")
            {
                try
                {
                    Color objData = new Color();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentColor = null;
                    BindColors();
                }
                catch (Exception ex)
                {
                    uipanelError.Visible = true;
                }
            }
        }
示例#2
0
 protected void uiRepeaterColor_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         Literal l = (Literal)e.Item.FindControl("uiLiteralColor");
         DataRowView row = (DataRowView)e.Item.DataItem;
         Color c = new Color ();
         c.LoadByPrimaryKey(Convert.ToInt32(row["ColorID"].ToString()));
         l.Text = "<label style='background-color: #" + c.ColorCode + ";width:20px;height:20px;'></label>";
     }
 }
        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();
            }
        }
示例#4
0
        protected void uiGridViewLayout_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);

            }
        }