void ProjectionList_ItemDataBound(object sender, DataGridItemEventArgs e) { string memo = e.Item.Cells[2].Text; memo = memo.Replace("\r\n", "<br />"); memo = memo.Replace("\n", "<br />"); e.Item.Cells[2].Text = memo; }
public void gridManage_ItemDataBound(object sender, DataGridItemEventArgs e) { switch (e.Item.ItemType) { case ListItemType.AlternatingItem: case ListItemType.Item: case ListItemType.SelectedItem: case ListItemType.EditItem: int id = int.Parse(e.Item.Cells[(int)Cells.id].Text); bool verified = bool.Parse(e.Item.Cells[(int)Cells.verified].Text); bool failed = bool.Parse(e.Item.Cells[(int)Cells.failed].Text); string address = e.Item.Cells[(int)Cells.address].Text; bool principal = bool.Parse(e.Item.Cells[(int)Cells.principal].Text); if (verified && ! failed) { e.Item.Cells[(int)Cells.resend].Text = string.Empty; } if (principal || !verified) { e.Item.Cells[(int)Cells.setprincipal].Text = string.Empty; } break; } }
protected void _gridRecords_DataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { AlertData _alert = new AlertData(); MapDataCommon.GetAlert(ref _alert, Session["trkCompany"].ToString(), deviceID, XtremeK.TimeZone.ToServerTime(e.Item.Cells[4].Text).ToString()); Color item_color = new Color(); if (_alert.AlertType == "Event") { item_color = ColorTranslator.FromHtml("#FFF26A"); } else if (_alert.AlertType == "Geofence" || _alert.AlertType == "Red Alert" || _alert.AlertType == "Speeding") { item_color = ColorTranslator.FromHtml("#FF766A"); } else { item_color = ColorTranslator.FromHtml("#61C04E"); } e.Item.BackColor = item_color; string html_color = ColorTranslator.ToHtml(item_color); e.Item.Attributes.Add("id", e.Item.ItemIndex.ToString()); e.Item.Attributes.Add("onclick", "highlightRow(this)"); e.Item.Attributes.Add("onmouseover", "this.style.cursor='pointer';this.style.backgroundColor = '#DCDCDC';"); e.Item.Attributes.Add("onmouseout", "this.style.cursor='pointer';this.style.backgroundColor = '" + html_color + "';"); } }
protected void g_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { TableCell cell1 = e.Item.Cells[0]; cell1.Text = cell1.Text + "期"; e.Item.Cells[1].Text = _Convert.ToHtmlCode(e.Item.Cells[1].Text); e.Item.Cells[2].Text = "倍数:" + e.Item.Cells[2].Text; double num = _Convert.StrToDouble(e.Item.Cells[3].Text, 0.0); e.Item.Cells[3].Text = (num == 0.0) ? "" : num.ToString("N"); int num2 = _Convert.StrToInt(e.Item.Cells[6].Text, 0); long num3 = _Convert.StrToLong(e.Item.Cells[8].Text, -1L); if (num2 != 0) { e.Item.Cells[4].Text = "系统撤单"; } else if (num3 > 0L) { e.Item.Cells[4].Text = "<font color='#330099'>已成功</font>"; e.Item.Cells[5].Text = "<a href='../Home/Room/Scheme.aspx?id=" + num3.ToString() + "' target='_blank'><font color=\"#330099\">查看方案</Font></a>"; } else { e.Item.Cells[4].Text = "<font color='Red'>进行中</font>"; } } }
protected void dgAlocacoes_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { Label lblTurmaEvento = (Label)e.Item.FindControl("lblTurmaEvento"); //Label lblDiscCod = (Label)e.Item.FindControl("lblDiscCod"); Label lblDisc = (Label)e.Item.FindControl("lblDisc"); Label lblResponsavel = (Label)e.Item.FindControl("lblResponsavel"); Label lblCurso = (Label)e.Item.FindControl("lblCurso"); Alocacao aloc = (Alocacao)e.Item.DataItem; if (aloc.Aula != null) { //lblDiscCod.Text = aloc.Aula.TurmaId.Disciplina.Cod.ToString(); lblDisc.Text = getNomeCurtoDisciplina(aloc.Aula.TurmaId.Disciplina.Nome) + " (" +aloc.Aula.TurmaId.Numero.ToString() + ")"; lblResponsavel.Text = aloc.Aula.TurmaId.Professor.Nome; lblCurso.Text = aloc.Aula.TurmaId.Curso.Nome;// + " - " + aloc.Delta; } else { lblDisc.Text = aloc.Evento.Titulo; //lblTurmaEvento.Text = aloc.Evento.Titulo; lblResponsavel.Text = aloc.Evento.AutorId.Nome; } } }
/// <summary> /// DataGrid Item Bound /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Datagrid_Itembound(object sender, DataGridItemEventArgs e) { InventoryData _inventoryData = (InventoryData)e.Item.DataItem; Literal producttypeImage = null; producttypeImage = e.Item.FindControl("productImage") as Literal; if (_inventoryData != null) { switch (_inventoryData.EntryType) { case Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product: producttypeImage.Text = "<img alt=\"\" src=\""+ m_refContentApi.AppPath+"images/UI/icons/brick.png\" />"; break; case Ektron.Cms.Common.EkEnumeration.CatalogEntryType.ComplexProduct: producttypeImage.Text = "<img alt=\"\" src=\""+m_refContentApi.AppPath+"images/UI/icons/bricks.png\" />"; break; case Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle: producttypeImage.Text = "<img alt=\"\" src=\""+m_refContentApi.AppPath+"images/UI/icons/package.png\" />"; break; case Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit: producttypeImage.Text = "<img alt=\"\" src=\""+m_refContentApi.AppPath+"images/UI/icons/box.png\" />"; break; case Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct: producttypeImage.Text = "<img alt=\"\" src=\"" + m_refContentApi.AppPath + "images/UI/icons/bookGreen.png\" />"; break; } } }
public void groups_ItemCreated(object sender, DataGridItemEventArgs e) { switch (e.Item.ItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: case ListItemType.SelectedItem: DataGrid values = (DataGrid)e.Item.FindControl("values"); TransitAccountPropertyGroup group = (TransitAccountPropertyGroup)e.Item.DataItem; if (group != null) { IList<TransitAccountPropertyValue> propertyvalues = SessionManager.GetCollection<TransitAccountPropertyValue, int, int>( AccountId, group.Id, (ServiceQueryOptions) null, SessionManager.AccountService.GetAccountPropertyValues); for (int i = propertyvalues.Count - 1; i >= 0; i--) { if (string.IsNullOrEmpty(propertyvalues[i].Value)) { propertyvalues.RemoveAt(i); } } if (propertyvalues.Count == 0) values.Visible = false; values.DataSource = propertyvalues; HtmlControl title = (HtmlControl)e.Item.FindControl("title"); title.Visible = (propertyvalues.Count > 0); } break; } }
protected void g_ItemDataBound(object sender, DataGridItemEventArgs e) { if ((e.Item.ItemType != ListItemType.Item) && (e.Item.ItemType != ListItemType.AlternatingItem)) { ListItemType itemType = e.Item.ItemType; } }
protected void MediaListGrid_ItemBound(object sender, DataGridItemEventArgs e) { if (action.ToLower() == "viewlibrarybycategory") { switch (e.Item.ItemType) { case ListItemType.AlternatingItem: case ListItemType.Item: if (e.Item.Cells[1].Text.Equals("REMOVE_ITEM") && e.Item.Cells[2].Text.Equals("REMOVE_ITEM")) { e.Item.Cells[0].ColumnSpan = 3; e.Item.Cells.RemoveAt(2); e.Item.Cells.RemoveAt(1); } else { e.Item.Cells[0].Attributes.Add("id", arr_TdName[j]); e.Item.Cells[1].Attributes.Add("id", (string) (arr_TdName[j] + "_0")); e.Item.Cells[2].Attributes.Add("id", (string) (arr_TdName[j] + "_1")); j++; } break; } } }
protected void billedTransaction_ItemDataBound(object sender, DataGridItemEventArgs e) { //Billed try { ListItemType it = (ListItemType)e.Item.ItemType; if (it == ListItemType.Header || it == ListItemType.Footer || it == ListItemType.Separator) return; DataRowView dr = (DataRowView)e.Item.DataItem; //Cap nhat TableCell linkCell = (TableCell)e.Item.Controls[13]; HyperLink h = (HyperLink)linkCell.Controls[0]; h.NavigateUrl = "credittransaction.aspx?card=" + dr["card_number_full"].ToString()+"&arn=" + dr["ref_num"].ToString(); //h.NavigateUrl = "credittransaction.aspx?card=" + dr["card_number_no"] + "&arn=" + dr["ref_num_billed"]; } catch (Exception ex) { executedb.WriteLogPri(Environment.NewLine + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + " - " + Session["Username"].ToString() + ": " + ex.Message); //Response.Write("<script>alert('Error in ItemDataBound')</script>"); Alert.Show("Error in ItemDataBound", this); } }
protected void g1_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.AlternatingItem) || (e.Item.ItemType == ListItemType.EditItem)) || (e.Item.ItemType == ListItemType.Item)) { Label label = e.Item.FindControl("lbDetail") as Label; if (this.ddlMonth.SelectedValue == "0") { label.Attributes.Add("onclick", "return GetSitePromotionDetailByYear('" + _Convert.StrToInt(e.Item.Cells[0].Text.Split(new char[] { '-' })[1], 1) + "');"); } else { label.Attributes.Add("onclick", "return GetSitePromotionDetail('" + e.Item.Cells[0].Text + "');"); } } if (e.Item.ItemType == ListItemType.Header) { if (this.ddlMonth.SelectedValue == "0") { e.Item.Cells[1].Text = "当月会员交易量"; } else { e.Item.Cells[1].Text = "本日会员交易量"; } } }
private void CustomerList_ItemCreated(object sender, DataGridItemEventArgs e) { if (e.Item.DataSetIndex > -1) { e.Item.DataItem = ((IList) customerOrders.DataSource)[e.Item.DataSetIndex]; } }
protected void g_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { if (e.Item.Cells[7].Text == "0") { e.Item.Cells[7].Text = "正常登录"; } else if (e.Item.Cells[7].Text == "1") { e.Item.Cells[7].Text = "<font color='red'>密码错误</font>"; } else if (e.Item.Cells[7].Text == "2") { e.Item.Cells[7].Text = "<font color='blue'>冻结登录</font>"; } else if (e.Item.Cells[7].Text == "3") { e.Item.Cells[7].Text = "取回密码"; } else if (e.Item.Cells[7].Text == "4") { e.Item.Cells[7].Text = "清除日志"; } else { e.Item.Cells[7].Text = "其它"; } } }
protected void g_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { double num = _Convert.StrToDouble((e.Item.Cells[2].FindControl("lblIn") as Label).Text, 0.0); e.Item.Cells[2].Text = (num == 0.0) ? "" : num.ToString("N"); num = _Convert.StrToDouble((e.Item.Cells[3].FindControl("Label2") as Label).Text, 0.0); e.Item.Cells[3].Text = (num == 0.0) ? "" : num.ToString("N"); num = _Convert.StrToDouble((e.Item.Cells[4].FindControl("Label3") as Label).Text, 0.0); e.Item.Cells[4].Text = (num == 0.0) ? "" : num.ToString("N"); num = _Convert.StrToDouble((e.Item.Cells[5].FindControl("Label4") as Label).Text, 0.0); e.Item.Cells[5].Text = (num == 0.0) ? "" : num.ToString("N"); num = _Convert.StrToDouble((e.Item.Cells[6].FindControl("Label5") as Label).Text, 0.0); e.Item.Cells[6].Text = (num == 0.0) ? "" : num.ToString("N"); num = _Convert.StrToDouble((e.Item.Cells[7].FindControl("Label6") as Label).Text, 0.0); e.Item.Cells[7].Text = (num == 0.0) ? "" : num.ToString("N"); long num2 = _Convert.StrToLong((e.Item.Cells[8].FindControl("Label7") as Label).Text, -1L); if (num2 >= 0L) { (e.Item.Cells[1].FindControl("lblMemo") as Label).Text = "<a href='../Home/Room/Scheme.aspx?id=" + num2.ToString() + "' target='_blank'><font color=\"#330099\">" + (e.Item.Cells[1].FindControl("lblMemo") as Label).Text + "</Font></a>"; } } else if (e.Item.ItemType == ListItemType.Footer) { e.Item.Cells[0].ColumnSpan = 2; e.Item.Cells.RemoveAt(8); e.Item.Cells[0].Text = "合计"; e.Item.Cells[1].Text = PF.GetSumByColumn(this.ds.Tables[0], 3, false, 30, this.gPager.PageIndex).ToString("N"); e.Item.Cells[2].Text = PF.GetSumByColumn(this.ds.Tables[0], 4, false, 30, this.gPager.PageIndex).ToString("N"); e.Item.Cells[3].Text = PF.GetSumByColumn(this.ds.Tables[0], 5, false, 30, this.gPager.PageIndex).ToString("N"); e.Item.Cells[5].Text = PF.GetSumByColumn(this.ds.Tables[0], 7, false, 30, this.gPager.PageIndex).ToString("N"); e.Item.Cells[7].Visible = false; } }
protected void dgProducts_ItemCreated(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer) { PlaceHolder PlaceHolder1 = (PlaceHolder)e.Item.FindControl("PlaceHolder1"); EasyMenu EasyMenu1 = new EasyMenu(); EasyMenu1.ID = "EasyMenu1_" + e.Item.ItemIndex.ToString(); EasyMenu1.ShowEvent = MenuShowEvent.Always; EasyMenu1.Position = MenuPosition.Horizontal; EasyMenu1.StyleFolder = "styles/horizontal1"; EasyMenu1.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu1.ID + "_item1", "Buy for...", "", "", "", "")); EasyMenu1.AddItem(new OboutInc.EasyMenu_Pro.MenuSeparator(EasyMenu1.ID + "_separator1", "|")); EasyMenu1.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu1.ID + "_item2", "Rent for...", "", "", "", "")); EasyMenu1.Width = "100%"; EasyMenu EasyMenu2 = new EasyMenu(); EasyMenu2.ID = "EasyMenu2_" + e.Item.ItemIndex.ToString(); EasyMenu2.ShowEvent = MenuShowEvent.MouseOver; EasyMenu2.Position = MenuPosition.Vertical; EasyMenu2.StyleFolder = "styles/horizontal1"; EasyMenu2.AttachTo = EasyMenu1.ID + "_item1"; EasyMenu2.Align = MenuAlign.Right; switch(e.Item.ItemIndex) { case 0: EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item1", "49.99$ for a piece", "", "", "", "")); EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item2", "89.99$ for two pieces", "", "", "", "")); break; case 1: EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item1", "29.99$ for a piece", "", "", "", "")); EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item2", "54.99$ for two pieces", "", "", "", "")); EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item3", "99.99$ for four pieces", "", "", "", "")); break; } EasyMenu EasyMenu3 = new EasyMenu(); EasyMenu3.ID = "EasyMenu3_" + e.Item.ItemIndex.ToString(); EasyMenu3.ShowEvent = MenuShowEvent.MouseOver; EasyMenu3.Position = MenuPosition.Vertical; EasyMenu3.StyleFolder = "styles/horizontal1"; EasyMenu3.AttachTo = EasyMenu1.ID + "_item2"; EasyMenu3.Align = MenuAlign.Right; switch(e.Item.ItemIndex) { case 0: EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item1", "2.99$ for a day", "", "", "", "")); EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item2", "4.99$ for two days", "", "", "", "")); EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item3", "9.99$ for a week", "", "", "", "")); break; case 1: EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item1", "Not Available", "", "", "", "")); break; } PlaceHolder1.Controls.Add(EasyMenu1); PlaceHolder1.Controls.Add(EasyMenu2); PlaceHolder1.Controls.Add(EasyMenu3); } }
protected void dgv_bill_QH_ItemDataBound(object sender, DataGridItemEventArgs e) { try { ListItemType it = (ListItemType)e.Item.ItemType; if (it == ListItemType.Header || it == ListItemType.Footer || it == ListItemType.Separator) return; DataRowView dr = (DataRowView)e.Item.DataItem; //Cap nhat TableCell linkCell = (TableCell)e.Item.Controls[9]; HyperLink h = (HyperLink)linkCell.Controls[0]; // h.NavigateUrl = "statementquerytxn.aspx?tb_Acc=" + TxtAcc_Credit.Text + "&Closing_bal=" + dr["Closing_bal"] + "&due_date=" + dr["due_date"] + "&Min_Due=" + dr["Min_pay"] + "&Open_bal=" + dr["open_bal"] + "&Stmt_date=" + dr["bill_date"] + "&curr_bill=" + dr["Curr_bill"] + "&Last_bill=" + dr["Last_bill"]; h.NavigateUrl = "Statement_Query_QH_Details.aspx?tb_Acc=" + TxtAcc_Credit.Text + "&NGAY_BILL=" + dr["NGAY_BILL"] + "&DUNO_DAUKY=" + dr["DUNO_DAUKY"] + "&DUTHU_DAUKY=" + dr["DUTHU_DAUKY"] + "&TRANO_DUNO=" + dr["TRANO_DUNO"] + "&TRANO_DUTHU=" + dr["TRANO_DUTHU"] + "&DUNO_CUOIKY=" + dr["DUNO_CUOIKY"] + "&DUTHU_CUOIKY=" + dr["DUTHU_CUOIKY"]; } catch (Exception ex) { executedb.WriteLogERROR(Session["Username"].ToString(), "IP: " + Request.UserHostAddress, this.Page.ToString(), System.Reflection.MethodBase.GetCurrentMethod().ToString(),ex.Message); //executedb.WriteLogPri(Environment.NewLine + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + " - " + Session["Username"].ToString() + ": " + ex.Message); //Response.Write("<script>alert('Error in ItemDataBound')</script>"); //Alert.Show("Error in ItemDataBound", this); Session["Error"] = "Error in ItemDataBound!!!"; Response.Redirect("~/Secure/Error_show.aspx"); } }
protected void g_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { TableCell cell1 = e.Item.Cells[0]; cell1.Text = cell1.Text + "期"; e.Item.Cells[1].Text = _Convert.ToHtmlCode(e.Item.Cells[1].Text); e.Item.Cells[2].Text = "倍数:" + e.Item.Cells[2].Text; double num = _Convert.StrToDouble(e.Item.Cells[3].Text, 0.0); e.Item.Cells[3].Text = (num == 0.0) ? "" : num.ToString("N"); int num2 = _Convert.StrToInt(e.Item.Cells[7].Text, 0); long num3 = _Convert.StrToLong(e.Item.Cells[9].Text, -1L); switch (num2) { case 0: if (num3 > 0L) { e.Item.Cells[4].Text = "<font color='#330099'>已成功</font>"; e.Item.Cells[5].Text = "<a href='Scheme.aspx?id=" + num3.ToString() + "' target='_blank'><font color=\"#330099\">查看方案</Font></a>"; return; } e.Item.Cells[4].Text = "<font color='Red'>进行中</font>"; ((Button)e.Item.Cells[6].FindControl("btnQuashIsuse")).Enabled = true; return; case 2: e.Item.Cells[4].Text = "系统撤单"; return; default: e.Item.Cells[4].Text = "用户撤消"; return; } } }
protected void g_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { e.Item.Cells[1].Text = _Convert.StrToDouble(e.Item.Cells[1].Text, 0.0).ToString("N"); } }
protected void docGrid_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { System.Web.UI.WebControls.LinkButton btnTplImg = (System.Web.UI.WebControls.LinkButton)e.Item.Cells[0].FindControl("btnImgTemplate"); string docFile = e.Item.Cells[0].Text; if (docFile == " " || string.IsNullOrEmpty(docFile)) { btnTplImg.Text = "<div class=\"hd-sp-img hd-sp-img-blank\" ></div>"; return; } switch (Path.GetExtension(docFile).ToLower()) { case ".pdf": case ".hpd": case ".hfd": // form template btnTplImg.Text = "<div class=\"hd-sp-img hd-sp-img-frm\" ></div>"; break; default: // text template btnTplImg.Text = "<div class=\"hd-sp-img hd-sp-img-txt\" ></div>"; break; } } }
private void dataExportExcel_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Header) { //Header Text Format can be done as follows e.Item.Font.Bold = true; //Adding Filter/Sorting functionality for the Excel int cellIndex = 0; while (cellIndex < e.Item.Cells.Count) { e.Item.Cells[cellIndex].Attributes.Add("x:autofilter", "all"); e.Item.Cells[cellIndex].Width = 200; e.Item.Cells[cellIndex].HorizontalAlign = HorizontalAlign.Center; cellIndex++; } } if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { int cellIndex = 0; while (cellIndex < e.Item.Cells.Count) { //Any Cell specific formatting should be done here e.Item.Cells[cellIndex].HorizontalAlign = HorizontalAlign.Left; cellIndex++; } } }
public void dataGrid_OnItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { object dataItem = e.Item.DataItem; HyperLink hlItemTitle = (HyperLink)e.Item.FindControl("hlItemTitle"); if(dataItem.GetType() == typeof(Monks.jkp_Audio)) { Monks.jkp_Audio audioItem = (Monks.jkp_Audio)dataItem; hlItemTitle.Text = audioItem.Aud_Title; hlItemTitle.NavigateUrl = "Media-ViewAudio.aspx?audioid=" + audioItem.Aud_ID.ToString(); } else if(dataItem.GetType() == typeof(Monks.jkp_Book)) { Monks.jkp_Book bookItem = (Monks.jkp_Book)dataItem; hlItemTitle.Text = bookItem.Bk_Title; hlItemTitle.NavigateUrl = "Media-ViewBook.aspx?bookid=" + bookItem.Bk_ID.ToString(); } else if(dataItem.GetType() == typeof(Monks.jkp_Video)) { Monks.jkp_Video videoItem = (Monks.jkp_Video)dataItem; hlItemTitle.Text = videoItem.Vid_Title; hlItemTitle.NavigateUrl = "Media-ViewVideo.aspx?videoid=" + videoItem.Vid_ID.ToString(); } } }
protected void dgLists_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem) { e.Item.Cells[1].Text = DateTimeHelper.GetChineseXq(Convert.ToInt32(e.Item.Cells[1].Text)); } }
protected void gUserDistills_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { double num = _Convert.StrToDouble(e.Item.Cells[1].Text, 0.0); e.Item.Cells[1].Text = (num == 0.0) ? "" : num.ToString("N"); num = _Convert.StrToDouble(e.Item.Cells[2].Text, 0.0); e.Item.Cells[2].Text = (num == 0.0) ? "" : num.ToString("N"); e.Item.Cells[3].Text = "提款"; switch (e.Item.Cells[4].Text) { case "0": e.Item.Cells[4].Text = "申请状态"; return; case "1": e.Item.Cells[4].Text = "已付款"; return; case "-1": e.Item.Cells[4].Text = "拒绝提款"; return; case "-2": e.Item.Cells[4].Text = "用户撤销提款"; return; } e.Item.Cells[4].Text = "处理中..."; } }
protected void dgGroupUser_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem || e.Item.ItemType==ListItemType.Header) { e.Item.Cells[0].Visible = false; } }
public void grdEmpl_OnItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { TotalEngHours += Convert.ToDecimal(Convert.ToDecimal(e.Item.Cells[1].Text)); TotalFabHours += Convert.ToDecimal(Convert.ToDecimal(e.Item.Cells[2].Text)); TotalfinHours += Convert.ToDecimal(Convert.ToDecimal(e.Item.Cells[3].Text)); TotalMiscHours += Convert.ToDecimal(Convert.ToDecimal(e.Item.Cells[4].Text)); TotalHours += Convert.ToDecimal(Convert.ToDecimal(e.Item.Cells[5].Text)); TotalPrice += Convert.ToDecimal(Convert.ToDecimal(e.Item.Cells[6].Text)); } else if (e.Item.ItemType == ListItemType.Footer) { e.Item.Cells[1].Text = TotalEngHours.ToString(); e.Item.Cells[1].Font.Bold = true; e.Item.Cells[1].HorizontalAlign = HorizontalAlign.Left; e.Item.Cells[2].Text = TotalFabHours.ToString(); e.Item.Cells[2].Font.Bold = true; e.Item.Cells[2].HorizontalAlign = HorizontalAlign.Left; e.Item.Cells[3].Text = TotalfinHours.ToString(); e.Item.Cells[3].Font.Bold = true; e.Item.Cells[3].HorizontalAlign = HorizontalAlign.Left; e.Item.Cells[4].Text = TotalMiscHours.ToString(); e.Item.Cells[4].Font.Bold = true; e.Item.Cells[4].HorizontalAlign = HorizontalAlign.Left; e.Item.Cells[5].Text = TotalHours.ToString(); e.Item.Cells[5].Font.Bold = true; e.Item.Cells[5].HorizontalAlign = HorizontalAlign.Left; e.Item.Cells[6].Text = TotalPrice.ToString(); e.Item.Cells[6].Font.Bold = true; e.Item.Cells[6].HorizontalAlign = HorizontalAlign.Left; } }
protected void g_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { TextBox box = (TextBox)e.Item.Cells[2].FindControl("tbSystemEndAheadMinute"); box.Text = e.Item.Cells[8].Text; TextBox box2 = (TextBox)e.Item.Cells[3].FindControl("tbChaseExecuteDeferMinute"); box2.Text = e.Item.Cells[9].Text; if (e.Item.Cells[7].Text.Replace(" ", "").Trim() == "") { box2.Visible = false; } int num = _Convert.StrToInt(e.Item.Cells[6].Text, -1); if (num != this.PreLotteryID) { this.PreLotteryID = num; if (this.PreLotteryColor.Name == Color.Linen.Name) { this.PreLotteryColor = Color.White; } else { this.PreLotteryColor = Color.Linen; } } e.Item.BackColor = this.PreLotteryColor; box.BackColor = this.PreLotteryColor; box2.BackColor = this.PreLotteryColor; } }
//------------------------------------------------------------------------------------------- void EarnedByMonth_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { decimal earned = Decimal.Parse(e.Item.Cells[1].Text); e.Item.Cells[1].Text = "$" + Math.Round(earned, 2) + " "; } }
protected void g_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { CheckBox box = (CheckBox)e.Item.Cells[4].FindControl("cbisShow"); box.Checked = _Convert.StrToBool(e.Item.Cells[7].Text, true); } }
protected void dgRole_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.EditItem || e.Item.ItemType == ListItemType.AlternatingItem) { LinkButton lkBtn = (LinkButton)e.Item.Cells[5].Controls[0]; lkBtn.Attributes.Add("onclick", "javascript:return confirm('确定要删除 " + e.Item.Cells[1].Text + " 吗?')"); } }
protected void ansGrid_ItemDataBound(object sender, DataGridItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { LinkButton lnkSelect = (LinkButton)e.Item.Cells[0].Controls[0]; lnkSelect.Text = e.Item.Cells[2].Text; } }
}//Errors if nothing to compare protected void tblCompare_ItemDataBound(object sender, DataGridItemEventArgs e) { string[] miles = new string[] { "Average Campus Distance", "Campus Distance" }; string[] checkboxes = new string[] { "Study Space", "Shuttle", "Wifi", "Furnished", "TV", "Trash Service", "Gym", "Parking", "Pets" }; string[] currency = new string[] { "Average Rent", "Average Utilities", "Average Parking Fee", "Average Pets Fee", "Average Misc Fees", "Rent", "Utilities", "Parking Fee", "Pets Fee", "Misc Fees" }; string[] stars = new string[] { "Overall Rating", "Average Noise Amount", "Average Safety", "Average Maintenance Quality", "Average Location Rating", "Overall Rating", "Noise Amount", "Safety", "Maintenance Quality", "Location Rating" }; string[] sqFoot = new string[] { "Average Square Footage", "Square Footage" }; string[] texts = new string[] { "Author", "Pros", "Cons" }; string[] dates = new string[] { "Lease Start Date", "Lease End Date" }; //Arrays of which row headers are to be what format if (0 <= Array.IndexOf(texts, e.Item.Cells[0].Text)) { for (int i = 1; e.Item.Cells.Count > i; i++) { if (" " != e.Item.Cells[i].Text) { e.Item.Cells[i].Text = e.Item.Cells[i].Text;//Displays text }//If not null else { e.Item.Cells[i].Text = "Unspecified"; } //Default to unspecified } //For each column after header column } //If row is to be a name if (0 <= Array.IndexOf(dates, e.Item.Cells[0].Text)) { for (int i = 1; e.Item.Cells.Count > i; i++) { if (" " != e.Item.Cells[i].Text) { e.Item.Cells[i].Text = DateTime.Parse(e.Item.Cells[i].Text).Date.ToString("yyyy-MM-dd");//Displays datetime converted to date }//If not null else { e.Item.Cells[i].Text = "Unspecified"; } //Default to unspecified } //For each column after header column } //If row is to be a date if (0 <= Array.IndexOf(stars, e.Item.Cells[0].Text)) { for (int i = 1; e.Item.Cells.Count > i; i++) { if (" " != e.Item.Cells[i].Text) { e.Item.Cells[i].Text = RateMyPlaceDisplayUtilities.generateStars(int.Parse(e.Item.Cells[i].Text));//Converts int value to stars out of max }//If not null else { e.Item.Cells[i].Text = RateMyPlaceDisplayUtilities.generateStars(0); } //Default to 0 stars } //For each column after header column } //If row is to be a stars if (0 <= Array.IndexOf(currency, e.Item.Cells[0].Text)) { for (int i = 1; e.Item.Cells.Count > i; i++) { if (" " != e.Item.Cells[i].Text) { e.Item.Cells[i].Text = string.Format("${0:0.00}", float.Parse(e.Item.Cells[i].Text));//Converts float value to currency }//If not null else { e.Item.Cells[i].Text = "$0.00"; } //Defaults to $0 } //For each column after header column } //If row is to be a currency if (0 <= Array.IndexOf(miles, e.Item.Cells[0].Text)) { for (int i = 1; e.Item.Cells.Count > i; i++) { if (" " != e.Item.Cells[i].Text) { e.Item.Cells[i].Text += " mi.";//Converts float value to miles }//If not null else { e.Item.Cells[i].Text = "Unspecified"; } //Default to unspecified } //For each column after header column } //If row is to be miles if (0 <= Array.IndexOf(checkboxes, e.Item.Cells[0].Text)) { for (int i = 1; e.Item.Cells.Count > i; i++) { System.Web.UI.WebControls.CheckBox newCheckBox = new System.Web.UI.WebControls.CheckBox(); newCheckBox.Checked = ("1" == e.Item.Cells[i].Text); //Sets checked value of checkbox based on integer text newCheckBox.Attributes.Add("class", "checkbox"); //Adds checkbox css class newCheckBox.Attributes.Add("onClick", "return false"); //Prevents checkbox from being used by users e.Item.Cells[i].Text = ""; //Clears text from cell e.Item.Cells[i].HorizontalAlign = HorizontalAlign.Center; //Centers checkbox in cell e.Item.Cells[i].Controls.Add(newCheckBox); //Adds checkbox to cell }//For each column after header column }//If row is to be a checkbox if (0 <= Array.IndexOf(sqFoot, e.Item.Cells[0].Text)) { for (int i = 1; e.Item.Cells.Count > i; i++) { if (" " != e.Item.Cells[i].Text) { e.Item.Cells[i].Text += " sq. ft.";//Converts float value to sq ft }//If not null else { e.Item.Cells[i].Text = "Unspecified"; } //Default to unspecified sq foot } //For each column after header column } //If row is to be square footage } //Called for each row added to table
public void ItemCreated2(Object sender, DataGridItemEventArgs e) { string rptType = (string)Session["MyReportType"]; // Get the type of the newly created item ListItemType itemType = e.Item.ItemType; if (itemType == ListItemType.Item || itemType == ListItemType.AlternatingItem) { // Get the data bound to the current row DataRowView drv = (DataRowView)e.Item.DataItem; if (drv != null) { int n = int.Parse(rptType); switch (n) { case 1: e.Item.Cells[1].Text = (String.Format("{0:c}", drv["Revenue"])).ToString(); break; case 2: e.Item.Cells[1].HorizontalAlign = HorizontalAlign.Right; e.Item.Cells[2].HorizontalAlign = HorizontalAlign.Right; e.Item.Cells[2].Text = (String.Format("{0:c}", drv["Revenue"])).ToString(); if (drv["Date"].ToString() == "") { e.Item.BackColor = Color.LightGray; e.Item.Font.Bold = true; e.Item.Cells[0].Text = "Total"; } break; case 3: e.Item.Cells[1].HorizontalAlign = HorizontalAlign.Right; e.Item.Cells[2].HorizontalAlign = HorizontalAlign.Right; e.Item.Cells[2].Text = (String.Format("{0:c}", drv["Revenue"])).ToString(); if (drv["User"].ToString() == "") { e.Item.BackColor = Color.LightGray; e.Item.Font.Bold = true; e.Item.Cells[0].Text = "Total"; } break; case 6: e.Item.Cells[5].Text = "'" + drv["Request_ID"]; e.Item.Cells[7].Text = (String.Format("{0:c}", drv["Total"])).ToString(); e.Item.Cells[7].HorizontalAlign = HorizontalAlign.Right; break; case 7: goto case 1; case 8: goto case 2; case 9: goto case 3; case 12: goto case 6; case 13: //TimeZoneChange.Ch1-Modified the Transaction Date to Transaction Date/Time(MST Arizona) by cognizant on 8-31-2010 as a part of Time Zone Change enhancement. if (drv["Transaction Date/Time(MST Arizona)"].ToString() == "") { e.Item.BackColor = Color.LightYellow; e.Item.Font.Bold = true; e.Item.Cells[1].HorizontalAlign = HorizontalAlign.Right; } break; } } } }
// EVENT HANDLER: ItemDataBound public void ItemDataBound2(Object sender, DataGridItemEventArgs e) { string rptType = (string)Session["MyReportType"]; // Retrieve the data linked through the relation // Given the structure of the data ONLY ONE row is retrieved DataRowView drv = (DataRowView)e.Item.DataItem; if (drv == null) { return; } // Check here the app-specific way to detect whether the // current row is a summary row int n = int.Parse(rptType); switch (n) { case 1: e.Item.Cells[1].Text = (String.Format("{0:c}", drv["Revenue"])).ToString(); break; case 2: e.Item.Cells[1].HorizontalAlign = HorizontalAlign.Right; e.Item.Cells[2].HorizontalAlign = HorizontalAlign.Right; e.Item.Cells[2].Text = (String.Format("{0:c}", drv["Revenue"])).ToString(); if (drv["Date"].ToString() == "") { e.Item.BackColor = Color.LightGray; e.Item.Font.Bold = true; e.Item.Cells[0].Text = "Total"; } break; case 3: e.Item.Cells[1].HorizontalAlign = HorizontalAlign.Right; e.Item.Cells[2].HorizontalAlign = HorizontalAlign.Right; e.Item.Cells[2].Text = (String.Format("{0:c}", drv["Revenue"])).ToString(); if (drv["User"].ToString() == "") { e.Item.BackColor = Color.LightGray; e.Item.Font.Bold = true; e.Item.Cells[0].Text = "Total"; } break; case 6: e.Item.Cells[5].Text = "'" + drv["Request_ID"]; e.Item.Cells[7].Text = (String.Format("{0:c}", drv["Total"])).ToString(); e.Item.Cells[7].HorizontalAlign = HorizontalAlign.Right; break; case 7: goto case 1; case 8: goto case 2; case 9: goto case 3; case 12: goto case 6; case 13: if (drv["Transaction Date/Time(MST Arizona)"].ToString() == "") { e.Item.BackColor = Color.LightYellow; e.Item.Font.Bold = true; e.Item.Cells[1].HorizontalAlign = HorizontalAlign.Right; } break; } }
protected void Datagrid1_ItemCreated(object sender, DataGridItemEventArgs e) { oListPage.GenerateSerialNumColumn(e.Item); }
protected void dgBeneficiary_ItemDataBound(object sender, DataGridItemEventArgs e) { }
protected void dgPaymentReimbursementDetail_ItemDataBound(object sender, DataGridItemEventArgs e) { }
private void ReportGrid_ItemDataBound(object sender, DataGridItemEventArgs e) { e.Item.Cells[1].Visible = false; }
private void DataGridCollectionViewSource_NewItemCanceled(object sender, DataGridItemEventArgs e) { DeleteButton.IsEnabled = false; App.Current.MainWindow.StatusBar.SetStatus(this, null); }
private void DataGridCollectionViewSource_NewItemCommitted(object sender, DataGridItemEventArgs e) { App.Current.MainWindow.StatusBar.SetStatus(this, null); }
private void DgContents_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var templateId = SqlUtils.EvalInt(e.Item.DataItem, "TemplateID"); var templateType = ETemplateTypeUtils.GetEnumType(SqlUtils.EvalString(e.Item.DataItem, "TemplateType")); var templateName = SqlUtils.EvalString(e.Item.DataItem, "TemplateName"); var createdFileFullName = SqlUtils.EvalString(e.Item.DataItem, "CreatedFileFullName"); var isDefault = TranslateUtils.ToBool(SqlUtils.EvalString(e.Item.DataItem, "IsDefault")); var ltlTemplateName = (Literal)e.Item.FindControl("ltlTemplateName"); var ltlFileName = (Literal)e.Item.FindControl("ltlFileName"); var ltlUseCount = (Literal)e.Item.FindControl("ltlUseCount"); var ltlTemplateType = (Literal)e.Item.FindControl("ltlTemplateType"); var ltlDefaultUrl = (Literal)e.Item.FindControl("ltlDefaultUrl"); var ltlCopyUrl = (Literal)e.Item.FindControl("ltlCopyUrl"); var ltlLogUrl = (Literal)e.Item.FindControl("ltlLogUrl"); var ltlCreateUrl = (Literal)e.Item.FindControl("ltlCreateUrl"); var ltlDeleteUrl = (Literal)e.Item.FindControl("ltlDeleteUrl"); var templateAddUrl = PageTemplateAdd.GetRedirectUrl(PublishmentSystemId, templateId, templateType); ltlTemplateName.Text = $@"<a href=""{templateAddUrl}"">{templateName}</a>"; if (templateType == ETemplateType.IndexPageTemplate || templateType == ETemplateType.FileTemplate) { var url = PageUtility.ParseNavigationUrl(PublishmentSystemInfo, createdFileFullName); ltlFileName.Text = $"<a href='{url}' target='_blank'>{createdFileFullName}</a>"; } ltlUseCount.Text = DataProvider.TemplateDao.GetTemplateUseCount(PublishmentSystemId, templateId, templateType, isDefault).ToString(); ltlTemplateType.Text = ETemplateTypeUtils.GetText(templateType); if (templateType != ETemplateType.FileTemplate) { if (isDefault) { ltlDefaultUrl.Text = "默认模板"; } else { var defaultUrl = PageUtils.GetCmsUrl(nameof(PageTemplate), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "TemplateID", templateId.ToString() }, { "SetDefault", true.ToString() } }); ltlDefaultUrl.Text = $@"<a href=""{defaultUrl}"" onClick=""javascript:return confirm('此操作将把此模板设为默认,确认吗?');"">设为默认</a>"; } } var copyUrl = PageTemplateAdd.GetRedirectUrlToCopy(PublishmentSystemId, templateId); ltlCopyUrl.Text = $@"<a href=""{copyUrl}"">快速复制</a>"; var logUrl = PageTemplateLog.GetRedirectUrl(PublishmentSystemId, templateId); ltlLogUrl.Text = $@"<a href=""{logUrl}"">修订历史</a>"; ltlCreateUrl.Text = $@"<a href=""javascript:;"" onclick=""{ModalProgressBar.GetOpenWindowStringWithCreateByTemplate( PublishmentSystemId, templateId)}"">生成页面</a>"; if (!isDefault) { var deleteUrl = PageUtils.GetCmsUrl(nameof(PageTemplate), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "TemplateID", templateId.ToString() }, { "Delete", true.ToString() } }); ltlDeleteUrl.Text = $@"<a href=""{deleteUrl}"" onClick=""javascript:return confirm('此操作将删除模板“{templateName}”,确认吗?');"">删除</a>"; } } }
protected void dtgSCTabel_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemIndex >= 0) { GetAllowanceType(); Label lblAllowance1 = ((Label)e.Item.FindControl("lblAllowType1")); Label lblAllowance2 = ((Label)e.Item.FindControl("lblAllowType2")); Label lblAllowance3 = ((Label)e.Item.FindControl("lblAllowType3")); Label lblAllowance4 = ((Label)e.Item.FindControl("lblAllowType4")); Label lblAllowance5 = ((Label)e.Item.FindControl("lblAllowType5")); Label lblAllowance6 = ((Label)e.Item.FindControl("lblAllowType6")); Label lblAllowance7 = ((Label)e.Item.FindControl("lblAllowType7")); Label lblAllowance8 = ((Label)e.Item.FindControl("lblAllowType8")); Label lblAllowance9 = ((Label)e.Item.FindControl("lblAllowType9")); Label lblIDAllowance1 = ((Label)e.Item.FindControl("lblIDAllowType1")); Label lblIDAllowance2 = ((Label)e.Item.FindControl("lblIDAllowType2")); Label lblIDAllowance3 = ((Label)e.Item.FindControl("lblIDAllowType3")); Label lblIDAllowance4 = ((Label)e.Item.FindControl("lblIDAllowType4")); Label lblIDAllowance5 = ((Label)e.Item.FindControl("lblIDAllowType5")); Label lblIDAllowance6 = ((Label)e.Item.FindControl("lblIDAllowType6")); Label lblIDAllowance7 = ((Label)e.Item.FindControl("lblIDAllowType7")); Label lblIDAllowance8 = ((Label)e.Item.FindControl("lblIDAllowType8")); Label lblIDAllowance9 = ((Label)e.Item.FindControl("lblIDAllowType9")); lblAllowance1.Text = mlDT_LISTALLOWANCETYPE.Rows[0]["allow_typename"].ToString(); lblAllowance2.Text = mlDT_LISTALLOWANCETYPE.Rows[1]["allow_typename"].ToString(); lblAllowance3.Text = mlDT_LISTALLOWANCETYPE.Rows[2]["allow_typename"].ToString(); lblAllowance4.Text = mlDT_LISTALLOWANCETYPE.Rows[3]["allow_typename"].ToString(); lblAllowance5.Text = mlDT_LISTALLOWANCETYPE.Rows[4]["allow_typename"].ToString(); lblAllowance6.Text = mlDT_LISTALLOWANCETYPE.Rows[5]["allow_typename"].ToString(); lblAllowance7.Text = mlDT_LISTALLOWANCETYPE.Rows[6]["allow_typename"].ToString(); lblAllowance8.Text = mlDT_LISTALLOWANCETYPE.Rows[7]["allow_typename"].ToString(); //lblAllowance9.Text = mlDT_LISTALLOWANCETYPE.Rows[8]["allow_typename"].ToString(); lblIDAllowance1.Text = mlDT_LISTALLOWANCETYPE.Rows[0]["allow_typeid"].ToString(); lblIDAllowance2.Text = mlDT_LISTALLOWANCETYPE.Rows[1]["allow_typeid"].ToString(); lblIDAllowance3.Text = mlDT_LISTALLOWANCETYPE.Rows[2]["allow_typeid"].ToString(); lblIDAllowance4.Text = mlDT_LISTALLOWANCETYPE.Rows[3]["allow_typeid"].ToString(); lblIDAllowance5.Text = mlDT_LISTALLOWANCETYPE.Rows[4]["allow_typeid"].ToString(); lblIDAllowance6.Text = mlDT_LISTALLOWANCETYPE.Rows[5]["allow_typeid"].ToString(); lblIDAllowance7.Text = mlDT_LISTALLOWANCETYPE.Rows[6]["allow_typeid"].ToString(); lblIDAllowance8.Text = mlDT_LISTALLOWANCETYPE.Rows[7]["allow_typeid"].ToString(); //lblIDAllowance9.Text = mlDT_LISTALLOWANCETYPE.Rows[8]["allow_typeid"].ToString(); if (FlagAction == "EDIT") { String ucAmount = ""; for (int x = 0; x < mlDT_LISTDATA.Rows.Count; x++) { ucAmount = mlDT_LISTDATA.Rows[x]["allow_amount1"].ToString(); if (((Label)e.Item.FindControl("lblNIK")).Text == mlDT_LISTDATA.Rows[x]["nik"].ToString()) { switch (mlDT_LISTDATA.Rows[x]["allow_typeid1"].ToString()) { case "AL007": ((ucInputNumber)e.Item.FindControl("ucAmountAllowType1")).Text = ucAmount.Replace(",00", ""); break; case "AL004": ((ucInputNumber)e.Item.FindControl("ucAmountAllowType2")).Text = ucAmount.Replace(",00", ""); break; case "AL005": ((ucInputNumber)e.Item.FindControl("ucAmountAllowType3")).Text = ucAmount.Replace(",00", ""); break; case "AL001": ((ucInputNumber)e.Item.FindControl("ucAmountAllowType4")).Text = ucAmount.Replace(",00", ""); break; case "AL002": ((ucInputNumber)e.Item.FindControl("ucAmountAllowType5")).Text = ucAmount.Replace(",00", ""); break; case "AL003": ((ucInputNumber)e.Item.FindControl("ucAmountAllowType6")).Text = ucAmount.Replace(",00", ""); break; case "AL006": ((ucInputNumber)e.Item.FindControl("ucAmountAllowType7")).Text = ucAmount.Replace(",00", ""); break; case "AL008": ((ucInputNumber)e.Item.FindControl("ucAmountAllowType8")).Text = ucAmount.Replace(",00", ""); break; } } } } } }
protected void ItemDataBound(Object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { TotMgn = TotMgn + Convert.ToDecimal(e.Item.Cells[5].Text); DispVal = Convert.ToDecimal(e.Item.Cells[5].Text); e.Item.Cells[5].Text = String.Format("{0:c}", DispVal); TotPounds = TotPounds + Convert.ToDecimal(e.Item.Cells[2].Text); DispVal = Math.Round(Convert.ToDecimal(e.Item.Cells[2].Text), 2); e.Item.Cells[2].Text = String.Format("{0:0,0.00}", DispVal); TotSales = TotSales + Convert.ToDecimal(e.Item.Cells[1].Text); DispVal = Convert.ToDecimal(e.Item.Cells[1].Text); e.Item.Cells[1].Text = String.Format("{0:c}", DispVal); } if (e.Item.ItemType == ListItemType.Footer) { e.Item.Cells[0].Text = "Grd-Tot:"; //e.Item.Cells[1].Text = String.Format("{0:c}", TotMgn); //e.Item.Cells[2].Text = String.Format("{0:0,0.00}", Math.Round(TotPounds, 2)); //if (TotPounds == 0) // e.Item.Cells[3].Text = "0"; //else // e.Item.Cells[3].Text = String.Format("{0:c}", TotMgn / TotPounds); //if (TotSales == 0) // e.Item.Cells[4].Text = "0"; //else // e.Item.Cells[4].Text = String.Format("{0:N2}%", TotMgn / TotSales * 100); //e.Item.Cells[5].Text = String.Format("{0:c}", TotSales); //if (TotPounds == 0) // e.Item.Cells[6].Text = "0"; //else // e.Item.Cells[6].Text = String.Format("{0:c}", TotSales / TotPounds); e.Item.Cells[1].Text = String.Format("{0:c}", TotSales); e.Item.Cells[2].Text = String.Format("{0:0,0.00}", Math.Round(TotPounds, 2)); if (TotPounds == 0) { e.Item.Cells[3].Text = "0"; } else { e.Item.Cells[3].Text = String.Format("{0:c}", TotSales / TotPounds); } if (TotSales == 0) { e.Item.Cells[4].Text = "0"; } else { e.Item.Cells[4].Text = String.Format("{0:N2}%", TotMgn / TotSales * 100); } e.Item.Cells[5].Text = String.Format("{0:c}", TotMgn); if (TotPounds == 0) { e.Item.Cells[6].Text = "0"; } else { e.Item.Cells[6].Text = String.Format("{0:c}", TotMgn / TotPounds); } } }
protected void dgExpense_ItemCreated1(object sender, DataGridItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem) || (e.Item.ItemType == ListItemType.SelectedItem)) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem) || (e.Item.ItemType == ListItemType.SelectedItem)) { try { int indx = e.Item.ItemIndex; DataTable tbl = (DataTable)dgExpense.DataSource; string strindex = tbl.Rows[indx]["record_id"].ToString(); ViewState["est_" + strindex] = tbl.Rows[indx]["amount"].ToString(); // create drop down DropDownList ddl = new DropDownList(); ddl.CssClass = "fontsmall"; ddl.Width = System.Web.UI.WebControls.Unit.Pixel(75); ddl.ID = "ddl_" + strindex; ListItem li = new ListItem("View", "0"); ddl.Items.Add(li); // create button Button btn2 = new Button(); btn2.CssClass = "actbtn_go_next_button"; btn2.ID = "btn_" + strindex; btn2.Text = "Go"; btn2.CausesValidation = false; btn2.Click += new System.EventHandler(this.btnMenu_Click); TableCell cell = e.Item.Cells[8]; cell.Controls.Add(ddl); cell.Controls.Add(btn2); TextBox txtapp = new TextBox(); txtapp.ID = "txt_app_" + strindex; txtapp.Text = tbl.Rows[indx]["approved_amount"].ToString(); txtapp.CssClass = "fontsmall"; txtapp.Width = System.Web.UI.WebControls.Unit.Pixel(50); TableCell cellApp = e.Item.Cells[2]; cellApp.Controls.Add(txtapp); // cellApp.Controls.Add(btn3); Button btn3 = new Button(); btn3.CssClass = "act_savenext_button"; btn3.ID = "cpy_" + strindex; btn3.Text = ""; btn3.Width = System.Web.UI.WebControls.Unit.Pixel(20); btn3.CausesValidation = false; btn3.ToolTip = "Copy To Approved Amount"; btn3.Click += new System.EventHandler(this.btnMenu_Click); Label lbl = new Label(); lbl.ID = "lbl_" + strindex; double dbl = Convert.ToDouble(tbl.Rows[indx]["amount"].ToString()); lbl.Text = dbl.ToString("$#,##0.00") + " "; lbl.CssClass = "fontsmall"; TableCell cellApp1 = e.Item.Cells[1]; cellApp1.Controls.Add(lbl); if (ViewState["inEdit"].ToString() == "T") cellApp1.Controls.Add(btn3); } catch { } } } }
protected void ItemDataBound(Object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Header) { if (Request.QueryString["Range"].ToString() != "MTD") { e.Item.Cells[8].Visible = false; e.Item.Cells[9].Visible = false; e.Item.Cells[10].Visible = false; e.Item.Cells[11].Visible = false; e.Item.Cells[12].Visible = false; } } if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { TotSales = TotSales + Convert.ToDecimal(e.Item.Cells[2].Text); DispVal = Convert.ToDecimal(e.Item.Cells[2].Text); e.Item.Cells[2].Text = String.Format("{0:c}", DispVal); TotPounds = TotPounds + Convert.ToDecimal(e.Item.Cells[3].Text); DispVal = Math.Round(Convert.ToDecimal(e.Item.Cells[3].Text), 2); e.Item.Cells[3].Text = String.Format("{0:0,0.00}", DispVal); TotMgn = TotMgn + Convert.ToDecimal(e.Item.Cells[5].Text); DispVal = Convert.ToDecimal(e.Item.Cells[5].Text); e.Item.Cells[5].Text = String.Format("{0:c}", DispVal); if (Request.QueryString["Range"].ToString() == "MTD") { TotMTDGoalMgn = TotMTDGoalMgn + (Convert.ToDecimal(e.Item.Cells[8].Text) * Convert.ToDecimal(e.Item.Cells[9].Text)); TotMTDGoal = TotMTDGoal + Convert.ToDecimal(e.Item.Cells[8].Text); DispVal = Convert.ToDecimal(e.Item.Cells[8].Text); e.Item.Cells[8].Text = String.Format("{0:c}", DispVal); DispVal = Convert.ToDecimal(e.Item.Cells[9].Text) * 100; e.Item.Cells[9].Text = String.Format("{0:N2}%", DispVal); HyperLink _hplYTDSalesDol = e.Item.FindControl("hplYTDSalesDol") as HyperLink; TotYTDSales = TotYTDSales + Convert.ToDecimal(_hplYTDSalesDol.Text); DispVal = Convert.ToDecimal(_hplYTDSalesDol.Text); string PrevMth1SalesDol = e.Item.Cells[17].Text.ToString().Trim(); string PrevMth2SalesDol = e.Item.Cells[18].Text.ToString().Trim(); string PrevMth3SalesDol = e.Item.Cells[19].Text.ToString().Trim(); string PrevMth1GMPct = e.Item.Cells[20].Text.ToString().Trim(); string PrevMth2GMPct = e.Item.Cells[21].Text.ToString().Trim(); string PrevMth3GMPct = e.Item.Cells[22].Text.ToString().Trim(); _hplYTDSalesDol.Text = String.Format("{0:c}", DispVal); _hplYTDSalesDol.NavigateUrl = "PrevMthSalesPopup.aspx?Mth1Sales=" + PrevMth1SalesDol + "&Mth2Sales=" + PrevMth2SalesDol + "&Mth3Sales=" + PrevMth3SalesDol + "&Mth1GMPct=" + PrevMth1GMPct + "&Mth2GMPct=" + PrevMth2GMPct + "&Mth3GMPct=" + PrevMth3GMPct; _hplYTDSalesDol.ForeColor = System.Drawing.Color.Green; _hplYTDSalesDol.Font.Underline = true; _hplYTDSalesDol.Attributes.Add("onclick", "var hWnd=window.open(this.href, 'YTDSales', 'height=50,width=350,scrollbars=no,status=no,top='+((screen.height/2) - (50/2))+',left='+((screen.width/2) - (350/2))+',resizable=no'); hWnd.opener = self; if (window.focus) {hWnd.focus()} return false;"); //TotYTDSales = TotYTDSales + Convert.ToDecimal(e.Item.Cells[10].Text); //DispVal = Convert.ToDecimal(e.Item.Cells[10].Text); //e.Item.Cells[10].Text = String.Format("{0:c}", DispVal); TotYTDGoalMgn = TotYTDGoalMgn + (Convert.ToDecimal(e.Item.Cells[11].Text) * Convert.ToDecimal(e.Item.Cells[12].Text)); TotYTDGoal = TotYTDGoal + Convert.ToDecimal(e.Item.Cells[11].Text); DispVal = Convert.ToDecimal(e.Item.Cells[11].Text); e.Item.Cells[11].Text = String.Format("{0:c}", DispVal); DispVal = Convert.ToDecimal(e.Item.Cells[12].Text) * 100; e.Item.Cells[12].Text = String.Format("{0:N2}%", DispVal); } else //Hide MTD/YTD Goal/Sales data { e.Item.Cells[8].Visible = false; e.Item.Cells[9].Visible = false; e.Item.Cells[10].Visible = false; e.Item.Cells[11].Visible = false; e.Item.Cells[12].Visible = false; } TotSalesWeb = TotSalesWeb + Convert.ToDecimal(e.Item.Cells[13].Text); DispVal = Convert.ToDecimal(e.Item.Cells[13].Text); e.Item.Cells[13].Text = String.Format("{0:c}", DispVal); TotMgnWeb = TotMgnWeb + Convert.ToDecimal(e.Item.Cells[14].Text); DispVal = Convert.ToDecimal(e.Item.Cells[14].Text); e.Item.Cells[14].Text = String.Format("{0:c}", DispVal); } if (e.Item.ItemType == ListItemType.Footer) { e.Item.Cells[1].Text = "Sub-Totals:"; e.Item.Cells[2].Text = String.Format("{0:c}", TotSales); e.Item.Cells[3].Text = String.Format("{0:0,0.00}", Math.Round(TotPounds, 2)); if (TotPounds == 0) { e.Item.Cells[4].Text = "0"; } else { e.Item.Cells[4].Text = String.Format("{0:c}", TotSales / TotPounds); } e.Item.Cells[5].Text = String.Format("{0:c}", TotMgn); if (TotPounds == 0) { e.Item.Cells[6].Text = "0"; } else { e.Item.Cells[6].Text = String.Format("{0:c}", TotMgn / TotPounds); } if (TotSales == 0) { e.Item.Cells[7].Text = "0"; } else { e.Item.Cells[7].Text = String.Format("{0:N2}%", TotMgn / TotSales * 100); } if (Request.QueryString["Range"].ToString() == "MTD") { e.Item.Cells[8].Text = String.Format("{0:c}", TotMTDGoal); if (TotMTDGoal == 0) { e.Item.Cells[9].Text = "0"; } else { e.Item.Cells[9].Text = String.Format("{0:N2}%", TotMTDGoalMgn / TotMTDGoal * 100); } e.Item.Cells[10].Text = String.Format("{0:c}", TotYTDSales); e.Item.Cells[11].Text = String.Format("{0:c}", TotYTDGoal); if (TotYTDGoal == 0) { e.Item.Cells[12].Text = "0"; } else { e.Item.Cells[12].Text = String.Format("{0:N2}%", TotYTDGoalMgn / TotYTDGoal * 100); } } else { e.Item.Cells[8].Visible = false; e.Item.Cells[9].Visible = false; e.Item.Cells[10].Visible = false; e.Item.Cells[11].Visible = false; e.Item.Cells[12].Visible = false; } e.Item.Cells[13].Text = String.Format("{0:c}", TotSalesWeb); e.Item.Cells[14].Text = String.Format("{0:c}", TotMgnWeb); if (TotSalesWeb == 0) { e.Item.Cells[15].Text = "0"; } else { e.Item.Cells[15].Text = String.Format("{0:N2}%", TotMgnWeb / TotSalesWeb * 100); } if (TotSales == 0) { e.Item.Cells[16].Text = "0"; } else { e.Item.Cells[16].Text = String.Format("{0:N2}%", TotSalesWeb / TotSales * 100); } } }
protected void dt_Prot_ItemDataBound(object sender, DataGridItemEventArgs e) { //if (UserManager.ruoloIsAutorized(this, "DO_DEL_DOC_FASC")) //{ // dt_Prot.Columns[10].Visible = true; //} //else //{ // dt_Prot.Columns[10].Visible = false; //} if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { e.Item.Cells[0].Font.Bold = true; //11 è la colonna che utilizza il metodo getnumprot con il quale //si estrae se è un protocollo RED oppure grigio o pred. BLACK //Label lbl=(Label)e.Item.Cells[10].Controls[1]; //if (lbl.Text=="") // e.Item.Cells[0].ForeColor=Color.Black; //else // e.Item.Cells[0].ForeColor=Color.Red; string dataAnnull = ((TableCell)e.Item.Cells[9]).Text; try { DateTime dt = Convert.ToDateTime(dataAnnull); e.Item.ForeColor = Color.Red; e.Item.Font.Bold = true; e.Item.Font.Strikeout = true; } catch { } // gestione della icona dei dettagli -- tolgo icona se non c'è doc acquisito //Label lblImg = e.Item.Cells[16].FindControl("lbl_chaImg") as Label; //ImageButton imgbtn = new ImageButton(); //if (lblImg != null && lblImg.Text == "0") //{ // if (e.Item.Cells[13].Controls[1].GetType().Equals(typeof(ImageButton))) // { // imgbtn = (ImageButton)e.Item.Cells[13].Controls[1]; // imgbtn.Visible = false; // } //} //else //{ // if (lblImg != null) // { // string image = FileManager.getFileIcon(Page, lblImg.Text.Trim().ToLower()); // if (e.Item.Cells[13].Controls[1].GetType().Equals(typeof(ImageButton))) // { // imgbtn = (ImageButton)e.Item.Cells[13].Controls[1]; // imgbtn.ImageUrl = image; // } // } //} } }
protected void dgListData_ItemDataBound(object sender, DataGridItemEventArgs e) { }
private void DGrdRelationRes_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemIndex == -1) { CheckBox checkBox = (CheckBox)e.Item.FindControl("cbAll"); if (checkBox != null) { checkBox.Attributes.Add("onclick", "selectAll(this)"); } } switch (e.Item.ItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: { DataRowView dataRowView = (DataRowView)e.Item.DataItem; e.Item.Attributes["onclick"] = "doClick(this,'" + this.DGrdRelationRes.ClientID + "');"; e.Item.Attributes["onmouseover"] = "doMouseOver(this);"; e.Item.Attributes["onmouseout"] = "doMouseOut(this);"; switch (int.Parse((dataRowView["ResourceStyle"].ToString() == "") ? "0" : dataRowView["ResourceStyle"].ToString())) { case 1: e.Item.Cells[6].Text = "人工"; break; case 2: e.Item.Cells[6].Text = "材料"; break; case 3: e.Item.Cells[6].Text = "机械"; break; default: e.Item.Cells[6].Text = "未知"; break; } try { if (dataRowView["CostType"].ToString() != "0") { ((TextBox)e.Item.Cells[7].FindControl("TxtCostType")).Text = this.GetstrCostType(dataRowView["CostType"].ToString()); ((HtmlInputHidden)e.Item.Cells[7].FindControl("HdnCostType")).Value = dataRowView["CostType"].ToString(); } else { string value = ""; string text = ""; switch (int.Parse((dataRowView["ResourceStyle"].ToString() == "") ? "0" : dataRowView["ResourceStyle"].ToString())) { case 1: value = "001001001"; text = "人工费"; break; case 2: value = "001001002"; text = "材料费"; break; case 3: value = "001001003"; text = "施工机械使用费"; break; } ((TextBox)e.Item.Cells[7].FindControl("TxtCostType")).Text = text; ((HtmlInputHidden)e.Item.Cells[7].FindControl("HdnCostType")).Value = value; } } catch { } try { ((CheckBox)e.Item.Cells[0].Controls[1]).Checked = (dataRowView["CostType"].ToString().Trim() != "0"); } catch { } return; } default: return; } }
protected void grdDetail_ItemDataBound(object sender, DataGridItemEventArgs e) { e.Item.Attributes.Add("onmouseover", "currColor=this.style.backgroundColor;this.style.backgroundColor='" + CommonLib.HPCOnmouseoverGrid() + "'"); e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=currColor"); }
/// ----------------------------------------------------------------------------- /// <summary> /// grdUsers_ItemDataBound runs when a row in the grid is bound /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 01/05/2007 Intial documentation /// </history> /// ----------------------------------------------------------------------------- private void grdUsers_ItemDataBound(object sender, DataGridItemEventArgs e) { var item = e.Item; if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.SelectedItem) { var imgApprovedDeleted = item.FindControl("imgApprovedDeleted"); var imgNotApprovedDeleted = item.FindControl("imgNotApprovedDeleted"); var imgApproved = item.FindControl("imgApproved"); var imgNotApproved = item.FindControl("imgNotApproved"); var user = (UserInfo)item.DataItem; if (user != null) { if (user.IsDeleted) { foreach (WebControl control in item.Controls) { control.Attributes.Remove("class"); control.Attributes.Add("class", "NormalDeleted"); } if (imgApprovedDeleted != null && user.Membership.Approved) { imgApprovedDeleted.Visible = true; } else if (imgNotApprovedDeleted != null && !user.Membership.Approved) { imgNotApprovedDeleted.Visible = true; } } else { if (imgApproved != null && user.Membership.Approved) { imgApproved.Visible = true; } else if (imgNotApproved != null && !user.Membership.Approved) { imgNotApproved.Visible = true; } } } var imgColumnControl = item.Controls[0].Controls[0]; if (imgColumnControl is HyperLink) { var editLink = (HyperLink)imgColumnControl; editLink.Visible = (!user.IsInRole(PortalSettings.AdministratorRoleName) || (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName))); if (editLink.Visible) { if (user.IsSuperUser) { editLink.Visible = PortalSettings.UserInfo.IsSuperUser; } } } imgColumnControl = item.Controls[1].Controls[0]; if (imgColumnControl is ImageButton) { var delImage = (ImageButton)imgColumnControl; delImage.Visible = IsCommandAllowed(user, "Delete"); } imgColumnControl = item.Controls[2].Controls[0]; if (imgColumnControl is HyperLink) { var rolesLink = (HyperLink)imgColumnControl; rolesLink.Visible = !user.IsSuperUser && (!user.IsInRole(PortalSettings.AdministratorRoleName) || (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName))); } imgColumnControl = item.Controls[3].FindControl("imgOnline"); if (imgColumnControl is Image) { var userOnlineImage = (System.Web.UI.WebControls.Image)imgColumnControl; userOnlineImage.Visible = user.Membership.IsOnLine; } imgColumnControl = item.Controls[3].Controls[0]; if (imgColumnControl is ImageButton) { var restoreImage = (ImageButton)imgColumnControl; restoreImage.Visible = IsCommandAllowed(user, "Restore"); } imgColumnControl = item.Controls[4].Controls[0]; if (imgColumnControl is ImageButton) { ImageButton removeImage = (ImageButton)imgColumnControl; removeImage.Visible = IsCommandAllowed(user, "Remove"); } } }
protected void dgInfoView_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { if (String.Compare(((DataRowView)e.Item.DataItem).Row[0].ToString(), "Display Status:", true) == 0) { DataSet iSet = PE_DAL.GetROODisplayStatusView(this.PubID); if (iSet.Tables[0].Rows.Count > 0) { Label l_displayStatus = new Label(); foreach (DataRow s in iSet.Tables[0].Rows) { if (l_displayStatus.Text.Length > 0) { l_displayStatus.Text += ", "; } l_displayStatus.Text += s.ItemArray[1].ToString(); } l_displayStatus.Text.Trim(); ((DataRowView)e.Item.DataItem).Row[0] = ""; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(l_displayStatus); } else { Label errLbl = new Label(); errLbl.Text = " - "; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(errLbl); } } else if (String.Compare(((DataRowView)e.Item.DataItem).Row[0].ToString(), "Subject:", true) == 0) { DataGrid dgRegReimb = new DataGrid(); dgRegReimb.ID = "innerDgRegReimb"; //Format the DataGrid to look cool. dgRegReimb.BorderWidth = (Unit)0; dgRegReimb.CellPadding = 4; dgRegReimb.CellSpacing = 0; dgRegReimb.GridLines = GridLines.None; dgRegReimb.BorderColor = Color.FromName("#E0E0E0"); dgRegReimb.ItemStyle.BackColor = Color.White; dgRegReimb.AlternatingItemStyle.BackColor = Color.FromName("LightGray"); dgRegReimb.ShowHeader = false; dgRegReimb.HeaderStyle.CssClass = "fieldLabel"; dgRegReimb.HeaderStyle.BackColor = Color.FromName("#ffff00"); dgRegReimb.AutoGenerateColumns = false; //****Add a series of BoundColumns****// //***Region Name***// BoundColumn bc = new BoundColumn(); //Set the BoundColumn Values bc.DataField = "Description"; //bc.HeaderText = "Region(s)"; bc.ItemStyle.Wrap = false; bc.ItemStyle.CssClass = "fieldLabel"; dgRegReimb.Columns.Add(bc); //****End BoundColumns****// DataSet iSet = PE_DAL.GetROOSubjectView(this.PubID); if (iSet != null) { dgRegReimb.DataSource = iSet; dgRegReimb.DataBind(); ((DataRowView)e.Item.DataItem).Row[0] = ""; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(dgRegReimb); } else { Label errLbl = new Label(); errLbl.Text = " - "; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(errLbl); } } //NCIPL_CC - Part of changes to have collections on NCIPL tab and ROO tab else if (String.Compare(((DataRowView)e.Item.DataItem).Row[0].ToString(), "Collections:", true) == 0) { //For Displaying Collections DataGrid dgCollectionsView = new DataGrid(); dgCollectionsView.ID = "innerdgCollectionsView"; //Format the DataGrid to look cool. dgCollectionsView.BorderWidth = (Unit)0; dgCollectionsView.CellPadding = 4; dgCollectionsView.CellSpacing = 0; dgCollectionsView.GridLines = GridLines.None; dgCollectionsView.BorderColor = Color.FromName("#E0E0E0"); dgCollectionsView.ItemStyle.BackColor = Color.White; dgCollectionsView.AlternatingItemStyle.BackColor = Color.FromName("LightGray"); dgCollectionsView.ShowHeader = false; dgCollectionsView.HeaderStyle.CssClass = "fieldLabel"; dgCollectionsView.HeaderStyle.BackColor = Color.FromName("#ffff00"); dgCollectionsView.AutoGenerateColumns = false; //****Add a series of BoundColumns****// //***Region Name***// BoundColumn bc = new BoundColumn(); //Set the BoundColumn Values //bc.DataField = "Description"; bc.DataField = "SeriesName"; //bc.HeaderText = "Region(s)"; bc.ItemStyle.Wrap = false; bc.ItemStyle.CssClass = "fieldLabel"; dgCollectionsView.Columns.Add(bc); //****End BoundColumns****// //DataSet iSet = PE_DAL.GetNCIPLStacksView(this.PubID); SeriesCollection iSet = PE_DAL.GetCollectionsByInterfaceByPubId("NCIPL_CC", this.PubID); //if (iSet != null) if (iSet.Count > 0) { dgCollectionsView.DataSource = iSet; dgCollectionsView.DataBind(); ((DataRowView)e.Item.DataItem).Row[0] = ""; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(dgCollectionsView); } else { Label errLbl = new Label(); errLbl.Text = " - "; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(errLbl); } } } }
protected void dgListData_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemIndex >= 0) { } }
protected void grdTinhThanhDS_ItemDataBound(object sender, DataGridItemEventArgs e) { e.Item.Attributes.Add("onmouseover", "currColor=this.style.backgroundColor;this.style.backgroundColor='#FDDBA5'"); e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=currColor"); }
/// <summary> /// React on edit canceled. /// </summary> /// <param name="sender">Ignored.</param> /// <param name="e">Event args.</param> private void _EditCanceled(object sender, DataGridItemEventArgs e) { _geocodablePage.OnEditCanceled(e); }
public void ControlItemDataBound(object Source, DataGridItemEventArgs E) { DataGridItem dataGridItem = (DataGridItem)Source; ListItemType typItem = E.Item.ItemType; SqlCommand sqlCmd = default(SqlCommand); DataTable sqlTable = new DataTable(); string strSQL = null; SqlConnection sqlConn = SMARTSConnectionOpen(); switch (typItem) { case ListItemType.Footer: switch (dataGridItem.ID) { //case "grdArtifacts": // DropDownList ddlData = (DropDownList)E.Item.FindControl("ddlArtifacts"); // ddlData = GetArtifacts(ddlData, sqlConn); // break; case "grdRelations": DropDownList ddlData = (DropDownList)E.Item.FindControl("ddlRelatedSystem"); sqlCmd = new SqlCommand("GetShapeList " + Common.ABSTRACTION_SYSTEM + "," + Common.SHAPETYPE_SYSTEM, sqlConn); sqlTable = sqlCmd.ExecuteDataTable(sqlConn); if (sqlTable.Rows.Count > 0) { ddlData.DataSource = sqlTable; ddlData.DataBind(); } ddlData.Items.Insert(0, CreateListItem("SELECT")); break; } break; case ListItemType.EditItem: switch (dataGridItem.ID) { case "grdLifecycle": DropDownList ddlValue = (DropDownList)E.Item.FindControl("ddlLifecycle"); Label lblValue = (Label)E.Item.FindControl("lblLifecycle_ID"); int intValue = Convert.ToInt32(lblValue.Text); sqlCmd = new SqlCommand("GetLifecycleList", sqlConn); sqlTable = sqlCmd.ExecuteDataTable(sqlConn); ddlValue.DataSource = sqlTable; ddlValue.DataBind(); ddlValue.Items.FindByValue(intValue.ToString()).Selected = true; ddlValue.Visible = true; if (grdRelations.Items.Count > 0) { ddlValue.Items.RemoveAt(ddlValue.Items.IndexOf(ddlValue.Items.FindByValue(Common.LIFECYCLE_RETIRE.ToString()))); } ToggleEditColumn(Common.STUB_intDivision, intValue); break; case "grdAttribute": PopulateControl_Attributes(E, sqlConn, ddlList); break; } break; } sqlConn.Close(); }
protected void dgList_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { var t = (OrderTransaction)e.Item.DataItem; if (t == null) { return; } var litTimeStamp = e.Item.FindControl("litTimeStamp") as Literal; var litOrderNumber = e.Item.FindControl("litOrderNumber") as Literal; var litDescription = e.Item.FindControl("litDescription") as Literal; var litAmount = e.Item.FindControl("litAmount") as Literal; var litCustomerName = e.Item.FindControl("litCustomerName") as Literal; if (litTimeStamp != null) { litTimeStamp.Text = TimeZoneInfo.ConvertTimeFromUtc(t.TimeStampUtc, HccApp.CurrentStore.Settings.TimeZone) .ToShortTimeString(); } if (litOrderNumber != null) { litOrderNumber.Text = t.OrderNumber; } if (litDescription != null) { var paymentMethod = PaymentMethods.Find(t.MethodId); var methodName = paymentMethod != null ? paymentMethod.MethodName : string.Empty; litDescription.Text = LocalizationUtils.GetActionType(t.Action, methodName); } if (litAmount != null) { litAmount.Text = t.AmountAppliedToOrder.ToString("C"); } if (litCustomerName != null) { litCustomerName.Text = "<strong>" + t.TempCustomerName + "</strong><br /><span class=\"tiny\">" + t.TempCustomerEmail + "</span>"; } TotalSub += t.TempEstimatedItemPortion; TotalDiscounts += t.TempEstimatedItemDiscount; TotalShip += t.TempEstimatedShippingPortion; TotalShipDiscounts += t.TempEstimatedShippingDiscount; TotalTax += t.TempEstimatedTaxPortion; TotalGrand += t.AmountAppliedToOrder; } else { if (e.Item.ItemType == ListItemType.Footer) { e.Item.Cells[1].Text = Localization.GetString("Totals"); e.Item.Cells[2].Text = string.Format("{0:C}", TotalSub); e.Item.Cells[3].Text = string.Format("{0:C}", TotalDiscounts); e.Item.Cells[4].Text = string.Format("{0:C}", TotalShip); e.Item.Cells[5].Text = string.Format("{0:C}", TotalShipDiscounts); e.Item.Cells[6].Text = string.Format("{0:C}", TotalTax); e.Item.Cells[7].Text = string.Format("{0:C}", TotalGrand); } } }
protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e) //DataGrid Veri Bağlama İşlemi { }
protected override void myGrid_ItemCreated(object sender, DataGridItemEventArgs e) { base.myGrid_ItemCreated(sender, e); }
/// <summary> /// Bug paginazione datagrid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnDataGridItemCreated(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Pager) { if (e.Item.Cells.Count > 0) { e.Item.Cells[0].Attributes.Add("colspan", e.Item.Cells[0].ColumnSpan.ToString()); } } Button btnRegistraSupporto = (Button)e.Item.FindControl("btnRegistraSupporto"); if (btnRegistraSupporto != null) { btnRegistraSupporto.Attributes.Add("onmouseover", "this.className='cbtnHover';"); btnRegistraSupporto.Attributes.Add("onmouseout", "this.className='cbtn';"); } Button btnVerificaSupporto = (Button)e.Item.FindControl("btnVerificaSupporto"); if (btnRegistraSupporto != null) { btnVerificaSupporto.Attributes.Add("onmouseover", "this.className='cbtnHover';"); btnVerificaSupporto.Attributes.Add("onmouseout", "this.className='cbtn';"); } Button btnStoriaVerifiche = (Button)e.Item.FindControl("btnStoriaVerifiche"); if (btnStoriaVerifiche != null) { btnStoriaVerifiche.Attributes.Add("onmouseover", "this.className='cbtnHover';"); btnStoriaVerifiche.Attributes.Add("onmouseout", "this.className='cbtn';"); } Button btn_storia_verifiche_remoto = (Button)e.Item.FindControl("btn_storia_verifiche_remoto"); if (btn_storia_verifiche_remoto != null) { btn_storia_verifiche_remoto.Attributes.Add("onmouseover", "this.className='cbtnHover';"); btn_storia_verifiche_remoto.Attributes.Add("onmouseout", "this.className='cbtn';"); } Button btnBrowse = (Button)e.Item.FindControl("btnBrowse"); if (btnBrowse != null) { btnBrowse.Attributes.Add("onmouseover", "this.className='cbtnHover';"); btnBrowse.Attributes.Add("onmouseout", "this.className='cbtn';"); } Button btnVerificaLeggibilita = (Button)e.Item.FindControl("btn_verifica_integrita_storage"); if (btnVerificaLeggibilita != null) { btnVerificaLeggibilita.Attributes.Add("onmouseover", "this.className='cbtnHover';"); btnVerificaLeggibilita.Attributes.Add("onmouseout", "this.className='cbtn';"); } Button btnVerificaIntegrita = (Button)e.Item.FindControl("btn_verifica_leggibilita"); if (btnVerificaIntegrita != null) { btnVerificaIntegrita.Attributes.Add("onmouseover", "this.className='cbtnHover';"); btnVerificaIntegrita.Attributes.Add("onmouseout", "this.className='cbtn';"); } Button btnVerificheIL = (Button)e.Item.FindControl("btn_verificheIL"); if (btnVerificheIL != null) { btnVerificheIL.Attributes.Add("onmouseover", "this.className='cbtnHover';"); btnVerificheIL.Attributes.Add("onmouseout", "this.className='cbtn';"); } Button btn_rigenerazione_istanza = (Button)e.Item.FindControl("btn_rigenerazione_istanza"); if (btn_rigenerazione_istanza != null) { btn_rigenerazione_istanza.Attributes.Add("onmouseover", "this.className='cbtnHover';"); btn_rigenerazione_istanza.Attributes.Add("onmouseout", "this.className='cbtn';"); } }
private void DgrdList_ItemDataBound(object sender, DataGridItemEventArgs e) { switch (e.Item.ItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: { BasicContactCorpModel basicContactCorpModel = (BasicContactCorpModel)e.Item.DataItem; e.Item.Cells[3].Text = this.Cont.GetCodeName(basicContactCorpModel.CorpKind.ToString(), "1"); e.Item.Cells[4].Text = this.Cont.GetCodeName(basicContactCorpModel.WorkType.ToString(), "2"); if (this.WindowType == "1") { e.Item.Attributes["ondblclick"] = string.Concat(new string[] { "doDblClickRow('", basicContactCorpModel.CorpID.ToString(), "','", basicContactCorpModel.CorpName, "');" }); } this.Session["id"] = basicContactCorpModel.CorpID.ToString(); e.Item.Attributes["onclick"] = string.Concat(new object[] { "doClick(this,'", this.DgrdList.ClientID, "');doClickRow('", basicContactCorpModel.CorpID, "','", basicContactCorpModel.CorpName, "','", basicContactCorpModel.FlowGuid.ToString(), "','", basicContactCorpModel.AuditState.ToString(), "','", basicContactCorpModel.UserCode, "','", this.CorpTypeID, "');" }); e.Item.Attributes["onmouseout"] = "doMouseOut(this);"; e.Item.Attributes["onmouseover"] = "doMouseOver(this);"; if (basicContactCorpModel.AuditState == -1) { e.Item.Cells[8].Text = "未审核"; } else { if (basicContactCorpModel.AuditState == -2) { e.Item.Cells[8].Text = "驳回"; } else { if (basicContactCorpModel.AuditState == 1) { e.Item.Cells[8].Text = "已审核"; } else { e.Item.Cells[8].Text = "处理中"; } } } break; } } if (this.CorpTypeID != 7) { e.Item.Cells[7].Style["display"] = "none"; } for (int i = 0; i < this.DgrdList.Columns.Count; i++) { string text = e.Item.Cells[i].Text.Trim(); if (e.Item.Cells[i].Text.Trim().Length > 30) { e.Item.Cells[i].Text = text.Substring(0, 30); e.Item.Cells[i].ToolTip = text; } e.Item.Cells[i].ToolTip = text; } }
protected void Item_Bound(object sender, DataGridItemEventArgs e) { LinkButton link; bool IsEnabled; // do transformations here (like converting our slotstart to local time // e // e.Item.Cells[3].Text = LocalDateFromUtc(e.Item.Cells[3].DataB if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { if (e.Item.Cells[0].Controls.Count > 0) { string strDateField; DateTime dateField; link = (LinkButton)e.Item.Cells[0].Controls[0]; // at this point, Item.Cells[3] is the UTC slotStart strDateField = e.Item.Cells[3].Text; dateField = DateTime.Parse(strDateField); if (e.Item.Cells[1].Text.Length == 0 || e.Item.Cells[1].Text == " ") { IsEnabled = false; } else { IsEnabled = true; link.ToolTip = e.Item.Cells[1].Text; } if (!IsLoggedIn) { link.Enabled = false; link.ToolTip = "Not logged in"; } if (link != null && DateTime.Compare(dateField, DateTime.UtcNow.Date) <= 0 && (bool)ShowingReserved) { link.Enabled = false; link.ToolTip = "date has passed: " + TimeZoneInfo.ConvertTimeFromUtc(dateField, timeZoneInfo) + " < " + TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, timeZoneInfo).Date; } if (link != null && IsEnabled && !(bool)ShowingReserved) { link.Enabled = false; } if (ShowingReserved && showAllReserved.Checked) { link.Enabled = false; link.ToolTip = "Can't release in ShowAll"; } } // finally, fixup the string to be local time e.Item.Cells[3].Text = TimeZoneInfo.ConvertTimeFromUtc(DateTime.Parse(e.Item.Cells[3].Text), timeZoneInfo).ToShortDateString(); } }