/// <summary> /// 检测库存数量 /// 库存不足,显示红色,且禁止发放 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void cgrdInventory_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is Telerik.Web.UI.GridDataItem) { Telerik.Web.UI.GridDataItem item = e.Item as Telerik.Web.UI.GridDataItem; var inventory = cgrdInventory.GetData <InventoryForReleaseClassView>(item.ItemIndex); var checkbox = item.FindControl(cgrdInventory.CheckControlID) as USCTAMis.Web.WebControls.UTMisCheckBox; //发放数量小于库存数,可发放,绿色;否则不允许发放,红色 if (inventory.ReleaseCount <= inventory.InventoryCount) { item["InventoryCount"].BackColor = System.Drawing.Color.LightGreen; } else { item["InventoryCount"].BackColor = System.Drawing.Color.Salmon; checkbox.Enabled = false; } //发放数量 大于 申报数量,红色 if (inventory.ReleaseCount > inventory.DeclarationCount) { item["ReleaseCount"].BackColor = System.Drawing.Color.Salmon; } } }
void grid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is Telerik.Web.UI.GridDataItem) { Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item; Literal litAttributes = (Literal)item.FindControl("litAttributes"); if (litAttributes != null) { int productId = Convert.ToInt32(item.GetDataKeyValue("ProductId")); string attributesXml = item.GetDataKeyValue("AttributesXml").ToString(); string results = string.Empty; if (!string.IsNullOrEmpty(attributesXml)) { var attributes = ProductAttributeParser.ParseProductAttributeMappings(customFields, attributesXml); if (attributes.Count > 0) { foreach (var a in attributes) { var values = ProductAttributeParser.ParseValues(attributesXml, a.CustomFieldId); if (values.Count > 0) { productProperties.ForEach(property => { if (property.ProductId == productId && property.CustomFieldId == a.CustomFieldId && values.Contains(property.CustomFieldOptionId)) { results += string.Format("<div><span>{0}</span>: {1}</div>", a.Name, property.OptionName); } }); } } } } if (results.Length > 0) { litAttributes.Text = string.Format("<div class='attributes'>{0}</div>", results); } } } }