protected void grid_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName == "luongcb") { ASPxLabel lbl_LuongCB = grid.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_LuongCB") as ASPxLabel; lbl_LuongCB.Text = InsertSymbol(e.CellValue.ToString()); } if (e.DataColumn.FieldName == "thoidiem") { ASPxLabel lbl_thoidiem = grid.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_thoidiem") as ASPxLabel; lbl_thoidiem.Text = string.Format("{0:dd/MM/yyyy}", e.CellValue); } if (e.DataColumn.FieldName == "soqd") { ASPxHyperLink hyperDowload = grid.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "hyperDowload") as ASPxHyperLink; ASPxImage imgFile = grid.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "imgFile") as ASPxImage; hyperDowload.Text = e.CellValue.ToString(); if (e.GetValue("fileKem").ToString().Trim() != "") { imgFile.ImageUrl = DotNetNuke.Common.Globals.ApplicationPath + "/images/imgadmin/file.png"; hyperDowload.NavigateUrl = DotNetNuke.Common.Globals.ApplicationPath + "/images/FileQD/" + e.GetValue("fileKem").ToString(); } else { imgFile.Visible = false; } } }
void AssignStatusImage(ASPxImage image) { RecurrentAppointmentEditFormTemplateContainer container = (RecurrentAppointmentEditFormTemplateContainer)Parent; ASPxSchedulerImages images = container.Control.Images; image.SpriteCssClass = images.GetStatusInfoImage(Page).SpriteProperties.CssClass; image.SpriteImageUrl = images.SpriteImageUrl; }
protected void grdTraining_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { try { if (e.DataColumn.FieldName == "id") { ASPxLabel lblTime = grdTraining.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblTime") as ASPxLabel; lblTime.Text = objTraining.GetTraining(Int32.Parse(e.CellValue.ToString())).fromdate.ToShortDateString() + " -" + objTraining.GetTraining(Int32.Parse(e.CellValue.ToString())).todate.ToShortDateString(); } if (e.DataColumn.FieldName == "employeeid") { ASPxLabel lblEmp = grdTraining.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblEmp") as ASPxLabel; lblEmp.Text = objEmployees.GetEmployees(Int32.Parse(e.CellValue.ToString())).fullname; } if (e.DataColumn.FieldName == "decision") { ASPxHyperLink hyperDowload = grdTraining.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "hyperDowload") as ASPxHyperLink; ASPxImage imgFile = grdTraining.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "imgFile") as ASPxImage; hyperDowload.Text = e.CellValue.ToString(); if (e.GetValue("fileKem").ToString().Trim() != "") { imgFile.ImageUrl = DotNetNuke.Common.Globals.ApplicationPath + "/images/imgadmin/file.png"; hyperDowload.NavigateUrl = DotNetNuke.Common.Globals.ApplicationPath + "/images/FileQD/" + e.GetValue("fileKem").ToString(); } else { imgFile.Visible = false; } } } catch { } }
protected void ASPxTreeList1_HtmlDataCellPrepared(object sender, TreeListHtmlDataCellEventArgs e) { if (e.Column.FieldName == "Status") { string fileName = string.Empty; switch ((string)e.CellValue) { case "deleted": fileName = "~/Images/deleted.png"; break; case "saved": fileName = "~/Images/saved.png"; break; } ASPxImage img = (ASPxImage)ASPxTreeList1.FindDataCellTemplateControl(e.NodeKey, e.Column, "ASPxImage1"); if (fileName != string.Empty) { img.ImageUrl = fileName; } else { img.Visible = false; } } }
protected void gvSItems_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == GridViewRowType.Data) { ASPxGridView grid = (ASPxGridView)sender; GridViewDataColumn column1 = gvSItems.Columns["isVerified"] as GridViewDataColumn; ASPxImage imgStatus = (ASPxImage)gvSItems.FindRowCellTemplateControl(e.VisibleIndex, column1, "imgStatus"); if (e.GetValue("isVerified").ToString() == "") { imgStatus.ImageUrl = ""; } else { bool value = (bool)e.GetValue("isVerified"); if (value == true) { imgStatus.ImageUrl = "~/Images/synced.png"; } else { imgStatus.ImageUrl = "~/Images/Delete.png"; } } } }
protected void PrepareContactCommandImage(ASPxImage image) { var container = (DataViewItemTemplateContainer)image.NamingContainer; var contact = (IContact)container.DataItem; image.JSProperties["cpContactKey"] = contact.ID; }
private void OpenImageFile(string fileRelativePath) { ASPxImage image = new ASPxImage(); image.ID = "image"; ASPxPopupControl1.Controls.Add(image); image.ImageUrl = fileRelativePath; }
protected void ASPxImage1_Load(object sender, EventArgs e) { ASPxImage image = (ASPxImage)sender; GridViewDataItemTemplateContainer c = (GridViewDataItemTemplateContainer)image.NamingContainer; string imageUrl = DataBinder.Eval(c.DataItem, "ImageUrl").ToString(); string altImageUrl = DataBinder.Eval(c.DataItem, "AltImageUrl").ToString(); image.ClientSideEvents.Init = string.Format("function(s, e) {{ OnImageInit(s, e, '{0}', '{1}'); }}", imageUrl, altImageUrl); }
void AssignImageProperties(ASPxImage image, ImageProperties imageProperties) { image.ImageUrl = EmptyImageProperties.GetGlobalEmptyImage(this.Page).Url; image.CssClass = imageProperties.SpriteProperties.CssClass; image.Width = imageProperties.Width; image.Height = imageProperties.Height; image.SpriteLeft = imageProperties.SpriteProperties.Left; image.SpriteTop = imageProperties.SpriteProperties.Top; }
//void cbValidate_Callback(object source, CallbackEventArgs e) //{ // string imageUrl = ""; // if (e.Parameter == "ok") // { // imageUrl = "~/Images/led_icon/accept.png"; // } // else // { // imageUrl = "~/Images/led_icon/cross.png"; // } // e.Result = Page.ResolveUrl(imageUrl); //} protected override void OnInit(EventArgs e) { base.OnInit(e); tbxBankNumber = new ASPxTextBox(); cbValidate = new ASPxCallback(); imgValidate = new ASPxImage(); table = new HtmlTable(); tableRow = new HtmlTableRow(); }
protected virtual ASPxEditBase CreateButtonSeparator(ASPxSmartGridViewCommandButtonSeparatorType buttonSeparatorType) { switch (buttonSeparatorType) { case ASPxSmartGridViewCommandButtonSeparatorType.Image: return(ButtonSeparatorImage = new ASPxImage()); default: return(ButtonSeparatorText = new ASPxLabel()); } }
protected void SetButtonHelp(ASPxImage img, String text = null) { if (!String.IsNullOrEmpty(text)) { img.ToolTip = text; } else { img.ToolTip = ResGeneral.Help; } img.ImageUrl = ResImageURL.Help; }
protected void treeList_HtmlDataCellPrepared(object sender, TreeListHtmlDataCellEventArgs e) { TreeListNode node = treeList.FindNodeByKeyValue(e.NodeKey); TreeListNode parentNode = node.ParentNode; bool canRestore = true; if (parentNode != null && parentNode["status"] != null) { int pstatus = -1; int.TryParse(parentNode["status"].ToString(), out pstatus); if (pstatus >= 4) { canRestore = false; } } string status = node["status"].ToString(); if (e.Column.FieldName == "VisibleText") { string fileName = string.Empty; ASPxImage imgTrash = null; ASPxImage imgRestore = null; ASPxImage imgNew = null; e.Cell.ToolTip = e.NodeKey; if (e.NodeKey == "*") //place holder for the trash icon { fileName = "~/Images/recycle1.png"; imgTrash = (ASPxImage)treeList.FindDataCellTemplateControl(e.NodeKey, e.Column, "Trash"); imgTrash.Visible = true; } else if (e.NodeKey.Contains("*") & e.NodeKey != "*") //deleted items { //make restore visible if (canRestore) { imgRestore = (ASPxImage)treeList.FindDataCellTemplateControl(e.NodeKey, e.Column, "Restore"); imgRestore.Visible = true; } } else if (status == "1") //status =1 - new item { imgNew = (ASPxImage)treeList.FindDataCellTemplateControl(e.NodeKey, e.Column, "New"); imgNew.Visible = true; } } }
public void InstantiateIn(Control container) { GridViewDataItemTemplateContainer gridContainer = (GridViewDataItemTemplateContainer)container; string textField = DataBinder.Eval(gridContainer.DataItem, "IsUpdated").ToString(); ASPxImage image = (ASPxImage)container.FindControl("imgStatus"); if (textField == "True") { image.ImageUrl = "~/Images/synced.png"; } else { image.ImageUrl = "~/Images/delete.png"; } container.Controls.Add(image); }
protected TableCell GetExportCell(ExportType type, String callBackID) { ASPxImage btn = new ASPxImage(); //btn.Text = type.ToString(); btn.ImageAlign = ImageAlign.Middle; btn.ImageUrl = String.Format("~/img/filetypes/{0}.png", type.ToString()); btn.Height = Unit.Pixel(16); btn.Width = Unit.Pixel(16); btn.ID = String.Format("{0}_btnExport{1}", callBackID, type.ToString()); btn.ClientInstanceName = btn.ID; btn.SetClientSideEventHandler("Click", "function(s,e){" + callBackID + ".PerformCallback('EXPORT||||" + this.grid.UniqueID + "||||" + type.ToString() + "');}"); TableCell cell = new TableCell(); cell.Controls.Add(btn); return(cell); }
protected void img_Init(object sender, EventArgs e) { ASPxImage img = sender as ASPxImage; GridViewEditItemTemplateContainer container = img.NamingContainer as GridViewEditItemTemplateContainer; Object value = DataBinder.Eval(container.DataItem, container.Column.FieldName); Boolean?b = null; if (value != null) { b = Convert.ToBoolean(value); } img.JSProperties["cpIndex"] = b.ToInt32(); img.CssClass = CheckBoxSpriteStyles[b.ToInt32()]; img.ImageUrl = DevExpress.Web.ASPxClasses.EmptyImageProperties.GetGlobalEmptyImage(Page).Url; }
public void InstantiateIn(Control container) { GridViewHeaderTemplateContainer gridContainer = (GridViewHeaderTemplateContainer)container; string fieldName = (gridContainer.Column as GridViewDataColumn).FieldName; Literal caption = new Literal(); caption.ID = "caption_" + gridContainer.ItemIndex.ToString(); caption.Text = fieldName; container.Controls.Add(caption); ASPxImage image = new ASPxImage(); image.ID = "unGroup_" + gridContainer.ItemIndex.ToString(); image.ImageUrl = "~/Delete.png"; image.ToolTip = "UnGroup column"; container.Controls.Add(image); image.ClientSideEvents.Click = string.Format("function(s, e){{ gridView.UnGroup ('{0}'); }}", fieldName); image.ClientSideEvents.Init = "OnImageInit"; }
protected void ASPxImage1_Init(object sender, EventArgs e) { ASPxImage img = (ASPxImage)sender; GridViewDataItemTemplateContainer templateContainer = (GridViewDataItemTemplateContainer)img.NamingContainer; int keyValue = (int)templateContainer.KeyValue; if (templateContainer.VisibleIndex % 2 == 0) { img.Visible = false; } if (templateContainer.Grid.DetailRows.IsVisible(templateContainer.VisibleIndex)) { img.ImageUrl = "~/Images/Ex.gif"; img.ClientSideEvents.Click = string.Format("function(s, e) {{ {0}.CollapseDetailRow('{1}'); }}", templateContainer.Grid.ClientID, templateContainer.VisibleIndex); } else { img.ImageUrl = "~/Images/Co.gif"; img.ClientSideEvents.Click = string.Format("function(s, e) {{ {0}.ExpandDetailRow('{1}'); }}", templateContainer.Grid.ClientID, templateContainer.VisibleIndex); } }
private WebControl CreateLayoutContentHeader(LayoutGroupTemplateContainer templateContainer, bool isCardItem) { WebControl div = null; if (templateContainer.ShowCaption && (!templateContainer.IsOnTabPage || templateContainer.ParentGroupDirection == FlowDirection.Vertical)) { div = new WebControl(HtmlTextWriterTag.Div); div.CssClass = "GroupHeader"; if (templateContainer.HasHeaderImage) { WebControl imageDiv = new WebControl(HtmlTextWriterTag.Div); ASPxImage imageHeader = new ASPxImage(); imageDiv.Controls.Add(imageHeader); imageHeader.CssClass = "Image"; ASPxImageHelper.SetImageProperties(imageHeader, templateContainer.HeaderImageInfo); imageHeader.AlternateText = templateContainer.Caption; div.Controls.Add(imageDiv); } WebControl labelDiv = new WebControl(HtmlTextWriterTag.Div); Label label = new Label(); labelDiv.Controls.Add(label); if (isCardItem && WebApplicationStyleManager.IsNewStyle && WebApplicationStyleManager.EnableGroupUpperCase) { label.Text = templateContainer.Caption.ToUpper(); } else { label.Text = templateContainer.Caption; } ((ISupportToolTip)this).SetToolTip(label, templateContainer.Model); templateContainer.CaptionControl = label; label.CssClass = "Label"; div.Controls.Add(labelDiv); } return(div); }
private void ProcessBitmap(IMemberInfo memberInfo, object objValue, IModelColumn columnModel, int RowNumber, ref String Value) { ASPxImage img = new ASPxImage(); if (columnModel != null) { if (columnModel.ImageEditorCustomHeight > 0) { img.Height = columnModel.ImageEditorCustomHeight; } if (columnModel.ImageEditorFixedHeight > 0) { img.Height = columnModel.ImageEditorFixedHeight; } } System.IO.MemoryStream stream = new System.IO.MemoryStream(); (objValue as System.Drawing.Bitmap).Save(stream, System.Drawing.Imaging.ImageFormat.Png); byte[] imageBytes = stream.ToArray(); string base64String = Convert.ToBase64String(imageBytes); img.ImageUrl = "data:image/png;base64," + base64String; img.CssClass = "img-responsive"; Value = Helpers.ContentHelper.RenderControl(img); }
protected virtual ASPxEditBase CreateButtonSeparator(ASPxSmartGridViewCommandButtonSeparatorType buttonSeparatorType) { switch (buttonSeparatorType) { case ASPxSmartGridViewCommandButtonSeparatorType.Image: return ButtonSeparatorImage = new ASPxImage(); default: return ButtonSeparatorText = new ASPxLabel(); } }
public void InstantiateIn(Control container) { Table cardTable = RenderHelper.CreateTable(); cardTable.BorderWidth = Unit.Empty; TableRow contentRow = new TableRow(); contentRow.VerticalAlign = VerticalAlign.Top; cardTable.Rows.Add(contentRow); Label caption = new Label { ID = WebIdHelper.GetCorrectedLayoutItemId(_templateContainer.Model, "", "_Caption"), Text = _templateContainer.Caption }; ASPxImage icon = new ASPxImage { ID = WebIdHelper.GetCorrectedLayoutItemId(_templateContainer.Model, "", "_Icon"), ImageUrl = ImageLoader.Instance.GetImageInfo("Action_Debug_Start").ImageUrl }; Label number = new Label { ID = WebIdHelper.GetCorrectedLayoutItemId(_templateContainer.Model, "", "_Number"), Text = "(6)" }; ASPxImage warning = new ASPxImage { ID = WebIdHelper.GetCorrectedLayoutItemId(_templateContainer.Model, "", "_Warning"), ImageUrl = ImageLoader.Instance.GetImageInfo("Action_CreateDashboard").ImageUrl }; var actionContainer = CreateActionContainerHolder(); ASPxImage collapsible = new ASPxImage(); collapsible.CssClass = "dxWeb_rpCollapseButton_XafTheme"; collapsible.ClientSideEvents.Click = ""; WebControl iconDiv = new WebControl(HtmlTextWriterTag.Div); iconDiv.Controls.Add(icon); WebControl captionDiv = new WebControl(HtmlTextWriterTag.Div); captionDiv.Controls.Add(caption); WebControl numberDiv = new WebControl(HtmlTextWriterTag.Div); numberDiv.Style.Add("float", "right"); numberDiv.Controls.Add(number); WebControl warningDiv = new WebControl(HtmlTextWriterTag.Div); warningDiv.Style.Add("float", "right"); warningDiv.Controls.Add(warning); WebControl collapsibleDiv = new WebControl(HtmlTextWriterTag.Div); collapsibleDiv.Style.Add("float", "right"); collapsibleDiv.Controls.Add(collapsible); WebControl containerDiv = new WebControl(HtmlTextWriterTag.Div); containerDiv.Style.Add("float", "right"); containerDiv.Controls.Add(actionContainer); container.Controls.Add(iconDiv); container.Controls.Add(captionDiv); container.Controls.Add(collapsibleDiv); container.Controls.Add(containerDiv); container.Controls.Add(warningDiv); container.Controls.Add(numberDiv); }
public static void SetImageValue(ASPxImage img, object objects) { try { if (objects != null) { img.ImageUrl = objects.ToString(); } } catch (Exception ex) { SiAuto.Main.LogString("Lỗi SetImageValue :", ex.ToString()); } }
public void loadStationStatus(int LineId, int AssySectionId, string StationAct) { var ProdItem = ProductionRepository.GetAndonStationStatus(LineId, AssySectionId, DateTime.Now, StationAct); int i = 0; foreach (ProductionStationStatus item in ProdItem) { string name = "Status" + i; //Generate new panelStation ASPxPanel panelStation = new ASPxPanel(); HtmlGenericControl divHeader = new HtmlGenericControl("div"); HtmlGenericControl divBody = new HtmlGenericControl("div"); HtmlGenericControl divFooter = new HtmlGenericControl("div"); HtmlGenericControl divFooterFin = new HtmlGenericControl("div"); HtmlGenericControl br = new HtmlGenericControl("br"); //Generate new labelStation in divHeader ASPxLabel lblStation = new ASPxLabel(); //lblStation.Font.Size = new FontUnit("small"); lblStation.ID = name + "Header"; lblStation.ClientInstanceName = lblStation.ID; //lblStation.Text = item.StationName; lblStation.Text = item.StationInitial; lblStation.CssClass = "panelText"; if (item.FaultCount > 0) { divHeader.Style.Add("background-color", "red"); lblStation.Style.Add("color", "white"); } divHeader.Controls.Add(lblStation); divHeader.Attributes.Add("class", "div-header-station"); //Generate new imgStatus in divBody ASPxImage imgStatus = new ASPxImage(); imgStatus.ID = name + "Status"; imgStatus.ClientInstanceName = imgStatus.ID; imgStatus.Width = 90; imgStatus.Height = 90; if (item.FINNumber != string.Empty) { imgStatus.ImageUrl = IMG_STATUS_GREEN; } else { imgStatus.ImageUrl = IMG_STATUS_RED; } divBody.Controls.Add(imgStatus); divBody.Attributes.Add("class", "div-body-station"); //Generate new lblModelVariant in divFooter ASPxLabel lblModelVariant = new ASPxLabel(); //lblModelVariant.Font.Size = new FontUnit("small"); lblModelVariant.ID = name + "Footer"; lblModelVariant.ClientInstanceName = lblModelVariant.ID; lblModelVariant.Text = item.ModelName + " " + item.VariantName; lblModelVariant.CssClass = "panelText2"; //lblModelVariant.Text = item.VINNumber; //endtes divFooter.Controls.Add(lblModelVariant); divFooter.Controls.Add(br); divFooter.Attributes.Add("class", "div-footer-station"); if (item.FINNumber.Length > 0) { // finnumber int len = item.FINNumber.Length - 6; ASPxLabel FIN = new ASPxLabel(); //FIN.Font.Size = new FontUnit("small"); FIN.ID = item.FINNumber + "Footer"; FIN.ClientInstanceName = item.FINNumber; FIN.CssClass = "panelText2"; FIN.Text = item.FINNumber.Substring(len, 6); divFooter.Controls.Add(FIN); } panelStation.Controls.Add(divHeader); panelStation.Controls.Add(divBody); panelStation.Controls.Add(divFooter); panelStation.CssClass = "panel-station"; divPanelCondition.Controls.Add(panelStation); // Response.Redirect(Request.RawUrl); } }
protected void ASPxGridView1_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { try { //string xMetric = ASPxGridView1.GetRowValues(0, "smetric").ToString(); string xMetric = Convert.ToString(e.GetValue("smetric")); e.Row.Cells[6].Text = loadHighlights(xMetric); e.Row.Cells[9].Text = loadUpdates(xMetric); string[] xValoresM = loadMonthly(xMetric); string[] xValoresY = loadYearly(xMetric); decimal v1 = Convert.ToDecimal(xValoresM[0]); decimal v2 = Convert.ToDecimal(xValoresM[1]); decimal v3 = Convert.ToDecimal(xValoresY[0]); decimal v4 = Convert.ToDecimal(xValoresY[1]); if (regresValueType(xMetric) == 1) { e.Row.Cells[1].Text = String.Format("{0:N0}", v1); e.Row.Cells[2].Text = String.Format("{0:N0}", v2); e.Row.Cells[3].Text = String.Format("{0:N0}", v3); e.Row.Cells[4].Text = String.Format("{0:N0}", v4); } if (regresValueType(xMetric) == 2) { e.Row.Cells[1].Text = String.Format("{0:C2}", v1 / 1000000) + "M"; e.Row.Cells[2].Text = String.Format("{0:C2}", v2 / 1000000) + "M"; e.Row.Cells[3].Text = String.Format("{0:C2}", v3 / 1000000) + "M"; e.Row.Cells[4].Text = String.Format("{0:C2}", v4 / 1000000) + "M"; } if (regresValueType(xMetric) == 3) { e.Row.Cells[1].Text = String.Format("{0:N2}", v1) + "%"; e.Row.Cells[2].Text = String.Format("{0:N2}", v2) + "%"; e.Row.Cells[3].Text = String.Format("{0:N2}", v3) + "%"; e.Row.Cells[4].Text = String.Format("{0:N2}", v4) + "%"; } if (regresValueType(xMetric) == 33) { e.Row.Cells[1].Text = String.Format("{0:N2}", v1) + ""; e.Row.Cells[2].Text = String.Format("{0:N2}", v2) + ""; e.Row.Cells[3].Text = String.Format("{0:N2}", v3) + ""; e.Row.Cells[4].Text = String.Format("{0:N2}", v4) + ""; } if (regresValueType(xMetric) == 22) { e.Row.Cells[1].Text = String.Format("{0:C2}", v1 / 1000) + "K"; e.Row.Cells[2].Text = String.Format("{0:C2}", v2 / 1000) + "K"; e.Row.Cells[3].Text = String.Format("{0:C2}", v3 / 1000) + "K"; e.Row.Cells[4].Text = String.Format("{0:C2}", v4 / 1000) + "K"; } ASPxImage img = ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, null, "imgControl") as ASPxImage; if (regresaIconType(xMetric) == 1) { if (v1 < v2) { img.ImageUrl = "img/bad.png"; } else { img.ImageUrl = "img/good.png"; } } else { if (v1 < v2) { img.ImageUrl = "img/goodB.png"; } else { img.ImageUrl = "img/badB.png"; } } } catch (Exception ex) { int errNum = -99999999; string errDesc = ""; HttpContext.Current.Items.Add("Exception", ex); if (ex is SqlException) { // Handle more specific SqlException exception here. SqlException odbcExc = (SqlException)ex; errNum = odbcExc.Number; errDesc = odbcExc.Message; } else { // Handle generic ones here. errDesc = ex.Message; } Server.Transfer("~\\CustomErrors\\Errors.aspx?handler=Dashboard.aspx&msg=" + errNum + "&errDesc=" + errDesc); } }