protected void grdCourses_RowDataBound(object sender, GridViewRowEventArgs e) { if (IsPostBack) { if (e.Row.RowType == DataControlRowType.Header) { Image SortImage = new Image(); for (int i = 0; i <= grdCourses.Columns.Count - 1; i++) { if (grdCourses.Columns[i].SortExpression == Session["SortColumn"].ToString()) { if (Session["SortDirection"].ToString() == "DESC") { SortImage.ImageUrl = "/images/desc.jpg"; SortImage.AlternateText = "Sort Descending"; } else { SortImage.ImageUrl = "/images/asc.jpg"; SortImage.AlternateText = "Sort Ascending"; } e.Row.Cells[i].Controls.Add(SortImage); } } } } }
protected void gridView_OnRowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { //e.Row.Cells[0].Text = "<input id='Checkbox2' type='checkbox' onclick='CheckAll()'/><label></label>"; } }
protected void GridView1_RowCreated(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { } }
protected void gvUsers_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { foreach (TableCell cell in e.Row.Cells) { if (cell.HasControls()) { LinkButton button = (LinkButton)cell.Controls[0]; button.CssClass = "noUnderLine"; if ((button != null) && this.hidSortExpression.Value.Equals(button.CommandArgument)) { Image child = new Image(); child.ImageUrl = this.hidSortDirection.Value.Equals("ASC") ? "~/Image/up.gif" : "~/Image/down.gif"; cell.Controls.Add(new LiteralControl(" ")); cell.Controls.Add(child); } } } } else if (e.Row.RowType == DataControlRowType.Footer) { DropDownList listControl = (DropDownList)e.Row.FindControl("ddlNewRoles"); this.oHelper.LoadData(this.dtRoles, listControl); listControl.DataBind(); } else if (((e.Row.RowType == DataControlRowType.DataRow) && (e.Row.RowState == DataControlRowState.Edit)) && (e.Row.FindControl("ddlRoles") != null)) { DropDownList list2 = (DropDownList)e.Row.FindControl("ddlRoles"); this.oHelper.LoadData(this.dtRoles, list2); list2.DataBind(); string strText = ((DataRowView)e.Row.DataItem).Row.ItemArray[4].ToString(); this.oHelper.SelectedByText(list2, strText); } }
protected void grdMain_RowDataBound(object sender, GridViewRowEventArgs e) { int cellIndex; string puntaje = ""; if (e.Row.RowType == DataControlRowType.DataRow) { cellIndex = 0; foreach (TableCell celda in e.Row.Cells) { if ((cellIndex + 1) != e.Row.Cells.Count) { var ddlCtl = (DropDownList)e.Row.FindControl("ptext" + cellIndex); var lblCtl = (Label)e.Row.FindControl("ptl" + cellIndex); if (ddlCtl != null) { string valorAnterior = ddlCtl.Text; ddlCtl.Items.Clear(); ddlCtl.Items.Add(new ListItem("N/A", "-1")); ddlCtl.Items.Add(new ListItem("0", "0")); ddlCtl.Items.Add(new ListItem(puntaje, puntaje)); ddlCtl.Text = valorAnterior; } if (lblCtl != null) puntaje = lblCtl.Text; } cellIndex++; } } }
protected void dgMonthlyScoreList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var ScoreItem = e.Row.DataItem as scoreListItem; var lblScoreName = e.Row.FindControl("lblScoreName") as Label; lblScoreName.Text = ScoreItem.scoreType.ScoreFaName; //var lblMaxPerDay = e.Row.FindControl("lblMaxPerDay") as Label; //lblMaxPerDay.Text = ScoreItem.scoreType.MaxPerDay.ToString(); var lblMaxPerMonth = e.Row.FindControl("lblMaxPerMonth") as Label; lblMaxPerMonth.Text = ScoreItem.scoreType.MaxPerMonth.ToString(); var lblCoefficentValue = e.Row.FindControl("lblCoefficentValue") as Label; lblCoefficentValue.Text = ScoreItem.scoreType.CoefficentValue.ToString(); } else if (e.Row.RowType == DataControlRowType.Footer) { var lblSum_NotFiltered = e.Row.FindControl("lblSum_NotFiltered") as Label; lblSum_NotFiltered.Text = (dgMonthlyScoreList.DataSource as List<scoreListItem>).Sum(o => o.Sum_NotFiltered).ToString(); var lblSum_Filtered = e.Row.FindControl("lblSum_Filtered") as Label; lblSum_Filtered.Text = (dgMonthlyScoreList.DataSource as List<scoreListItem>).Sum(o => o.Sum_Filtered).ToString(); } }
protected void grdBusqueda_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["OnClick"] = "return GetSelectedRowC(this);"; } }
protected void gvAmortizations_RowDataBound(object sender, GridViewRowEventArgs e) { GridView gv = (GridView)sender; if (e.Row.RowType == DataControlRowType.DataRow && ((GridView)sender).EditIndex == -1) { e.Row.Attributes["onmouseover"] = "this.style.cursor = 'hand';this.style.textDecoration = 'underline';"; e.Row.Attributes["onmouseout"] = "this.style.textDecoration = 'none';"; e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(gv, "Select$" + e.Row.RowIndex); //e.Row.Attributes["onclick"] = "if (!confirm('Are you sure this has been paid?')) return false;"; // e.Row.Attributes["onclick"] = @" return alertify.defaults.glossary.title='Amortization Payment'; // alertify.confirm('Are you sure this amortization date has been paid?', // function (e) { // if (e) { // return true; // } else { // return false; // }}) // .set({ // 'labels': {ok:'Accept', cancel:'Deny'} // }).show();"; if ((bool)DataBinder.Eval(e.Row.DataItem, "Paid") == false) { //((CheckBox)e.Row.FindControl("ckPaid")).Enabled = true; ((CheckBox)e.Row.FindControl("ckPaid")).Checked = false; } else { //((CheckBox)e.Row.FindControl("ckPaid")).Enabled = false; ((CheckBox)e.Row.FindControl("ckPaid")).Checked = true; } } }
protected void grdTeam_RowDataBound(object sender, GridViewRowEventArgs e) { team drv = (team)e.Row.DataItem; if (e.Row.RowType == DataControlRowType.DataRow) { if (drv.districtId != null && drv.districtId != Guid.Empty) { Guid rowDistrtict = new Guid(drv.districtId.ToString()); district districtName = _dal.SoccerEntities.districts.Where(res => res.id == rowDistrtict).First(); e.Row.Cells[2].Text = districtName.name; } if (drv.leagueId != null && drv.leagueId != Guid.Empty) { Guid teamLeague = new Guid(drv.leagueId.ToString()); Leauge leageName = _dal.SoccerEntities.Leauges.Where(res => res.id == teamLeague).First(); e.Row.Cells[3].Text = leageName.LeagueName; } } }
protected void gvMyProxies_OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Proxy proxy = (Proxy)e.Row.DataItem; Literal litName = (Literal)e.Row.FindControl("litName"); Literal litEmail = (Literal)e.Row.FindControl("litEmail"); LinkButton lnkDelete = (LinkButton)e.Row.FindControl("lnkDelete"); if (proxy.PersonURI != "") litName.Text = "<a href='" + proxy.PersonURI + "'>" + proxy.Name + "</a>"; else litName.Text = proxy.Name; if (proxy.Email != null) litEmail.Text = "<a href='mailto:" + proxy.Email + "'>" + proxy.Email + "</a>"; else litEmail.Visible = false; if (proxy.CanDelete) { lnkDelete.CommandArgument = proxy.UserID; lnkDelete.CommandName = "UserID"; } else lnkDelete.Visible = false; } }
protected void gvFileList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[3].Visible = false; } }
protected void gv_ExpandedRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { PDFStats stats = (PDFStats)e.Row.DataItem; _totalExpandedPdfs += stats.NumberofPdfs; _totalExpandedPdfsWithOcr += stats.PdfsWithOcr; _totalExpandedPdfsWithArticleInfo += stats.PdfsWithArticleMetadata; _totalExpandedPdfsMissingImages += stats.PdfsWithMissingImages; _totalExpandedPdfsMissingOcr += stats.PdfsWithMissingOcr; _totalExpandedMissingImages += stats.TotalMissingImages; _totalExpandedMissingOcr += stats.TotalMissingOcr; _totalExpandedMinutes += (stats.TotalMinutesToGenerate == null ? 0 : stats.TotalMinutesToGenerate); if (stats.PdfStatusID == 40) e.Row.BackColor=System.Drawing.Color.MistyRose; //if (stats.PdfsWithMissingImages > 0) e.Row.Cells[6].BackColor = System.Drawing.Color.MistyRose; //if (stats.PdfsWithMissingOcr > 0) e.Row.Cells[7].BackColor = System.Drawing.Color.MistyRose; //if (stats.TotalMissingImages > 0) e.Row.Cells[8].BackColor = System.Drawing.Color.MistyRose; //if (stats.TotalMissingOcr > 0) e.Row.Cells[9].BackColor = System.Drawing.Color.MistyRose; } else if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[0].Text = "Total"; e.Row.Cells[3].Text = _totalExpandedPdfs.ToString(); e.Row.Cells[4].Text = _totalExpandedPdfsWithOcr.ToString(); e.Row.Cells[5].Text = _totalExpandedPdfsWithArticleInfo.ToString(); e.Row.Cells[6].Text = _totalExpandedPdfsMissingImages.ToString(); e.Row.Cells[7].Text = _totalExpandedPdfsMissingOcr.ToString(); e.Row.Cells[8].Text = _totalExpandedMissingImages.ToString(); e.Row.Cells[9].Text = _totalExpandedMissingOcr.ToString(); e.Row.Cells[10].Text = ((double)_totalExpandedMinutes / (double)_totalExpandedPdfs).ToString("#.00"); } }
protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblUserType = e.Row.FindControl("lblUserType") as Label; NoName.NetShop.ShopFlow.ExpressInfoModel model = e.Row.DataItem as NoName.NetShop.ShopFlow.ExpressInfoModel; MemberType userType = (MemberType)model.UserType; UserLevel userLevel = (UserLevel)model.UserLevel; switch (userType) { case MemberType.Personal: lblUserType.Text = userLevel.ToString(); break; case MemberType.Company: lblUserType.Text = "鼎企会员"; break; case MemberType.Famly: lblUserType.Text = "鼎宅会员"; break; case MemberType.School: lblUserType.Text = "鼎校会员"; break; default: lblUserType.Text = userLevel.ToString(); break; } } }
protected void gvAdjustmentItems_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int stationeryID = (int)DataBinder.Eval(e.Row.DataItem, "StationeryID"); DAL.AdjustmentType adjType = (AdjustmentType) DataBinder.Eval(e.Row.DataItem, "Type"); if (stationeryID != 0) { Literal ltl = e.Row.FindControl("ltlDescription") as Literal; Literal type = e.Row.FindControl("ltlType") as Literal; if (ltl != null) { using (CatalogManager cm = new CatalogManager()) { Stationery s = cm.FindStationeryByID(stationeryID); if (s != null) ltl.Text = s.Description; } } if (type != null) using (AdjustmentVoucherManager avm = new AdjustmentVoucherManager()) { type.Text = adjType.ToString(); } } } }
protected void gv_detalle_equipos_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { e.Row.ControlStyle.BackColor = Color.LightGray; } }
void demo_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { e.Row.TableSection = TableRowSection.TableHeader; } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // Set the hand mouse cursor for the selected row. e.Row.Attributes.Add("OnMouseOver", "this.style.cursor = 'hand'; this.style.background = '#003366';"); e.Row.Attributes.Add("OnMouseOut", "this.style.background = '#F9F6F4';"); // The seelctButton exists for ensuring the selection functionality // and bind it with the appropriate event hanlder. LinkButton selectButton = new LinkButton() { CommandName = "Select", Text = e.Row.Cells[0].Text }; selectButton.Font.Underline = false; selectButton.ForeColor = System.Drawing.Color.Black; e.Row.Cells[0].Controls.Add(selectButton); //e.Row.Attributes["OnClick"] = // Page.ClientScript.GetPostBackClientHyperlink(selectButton, ""); e.Row.Attributes["OnClick"] = Page.ClientScript.GetPostBackClientHyperlink((Control)sender, "Select$" + e.Row.RowIndex); } }
public void CreateIntroText(object sender, GridViewRowEventArgs e) { string val = string.Empty; if (e.Row.RowType == DataControlRowType.DataRow) { DataRow dr = ((DataRowView)e.Row.DataItem).Row; TextBox txtEditQuantity = (TextBox)e.Row.FindControl("txtEditQuantity"); txtEditQuantity.Attributes.Add("data-productnumber", dr["ProductNumber"].ToString()); txtEditQuantity.Attributes.Add("data-originalvalue", dr["Quantity"].ToString()); txtEditQuantity.Text = dr["Quantity"].ToString(); if (dataRowCount == 0) { // first text field txtEditQuantity.Attributes.Add("data-intro", "When this value is changed, and you move on to another textbox, it will immediately be saved. A successful save is confirmed by the checkbox icon."); txtEditQuantity.Attributes.Add("data-step", "3"); txtEditQuantity.Attributes.Add("data-position", "left"); // first product id link HyperLink hlnkProduct = (HyperLink)e.Row.FindControl("hlnkProduct"); hlnkProduct.Attributes.Add("data-intro", "This loads the product page."); hlnkProduct.Attributes.Add("data-step", "4"); } dataRowCount++; } }
protected void gvPrivilegeList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["style"] = "Cursor:pointer"; } }
protected void StudentsGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (IsPostBack) { //if header row has been clicked if (e.Row.RowType == DataControlRowType.Header) { LinkButton linkButton = new LinkButton(); for (int index = 0; index < StudentsGridView.Columns.Count - 1; index++) { if (StudentsGridView.Columns[index].SortExpression == Session["SortColumn"].ToString()) { if (Session["SortDirection"].ToString() == "ASC") { linkButton.Text = "<i class='fa fa-caret-up fa-lg'></i>"; } else { linkButton.Text = "<i class='fa fa-caret-down fa-lg'></i>"; } e.Row.Cells[index].Controls.Add(linkButton); } } } } }
protected void gvScore_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //����ƶ���ÿ��ʱ��ɫ����Ч�� e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); //�����������ָ����״Ϊ"С��" e.Row.Attributes["style"] = "Cursor:hand"; LinkButton lbtName = e.Row.FindControl("lbtnName") as LinkButton; Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; if (lbtName.Text == "�κ���") { int basid = Convert.ToInt32(gvScore.DataKeys[e.Row.RowIndex]["DriverScoreId"].ToString()); DriverScoreInfo ds = new DriverScoreInfo(basid); if (ds.IsSubmit == 2) { btnSubmit.Enabled = false; } } else if (lbtName.Text == "�Ų�") { int fid = Convert.ToInt32(gvScore.DataKeys[e.Row.RowIndex]["NurseScoreId"].ToString()); NurseScoreInfo ma = new NurseScoreInfo(fid); if (ma.IsSubmit == 2) { btnSubmit.Enabled = false; } } } }
protected void grdPesquisa_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { grdPesquisa.Columns[0].Visible = false; } }
protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ((LinkButton)e.Row.Cells[0].Controls[0]).OnClientClick = "if(!confirm('確定要刪除嗎'))return false;"; } }
// adds glyph to header according to current sort settings. protected void GridViewOrders_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { AddGlyph(this.GridViewOrders, e.Row); } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { if (e.Row.RowType == DataControlRowType.DataRow) { if ((e.Row.RowState & DataControlRowState.Edit) > 0) { DropDownList ddlKategorija = (DropDownList)e.Row.FindControl("ddlKategorija"); ddlKategorija.DataSource = temp.GetAllKats(); ddlKategorija.DataValueField = "KategorijaId"; ddlKategorija.DataTextField = "NazivKategorije"; ddlKategorija.DataBind(); ddlKategorija.SelectedIndex = temp.getKatID(Convert.ToInt32(GridView1.DataKeys[e.Row.RowIndex].Value.ToString()))-1; //ddlKategorija.SelectedItem.Text = temp.getKateg(ddlKategorija.SelectedIndex); int pk = ddlKategorija.SelectedIndex + 1; DropDownList ddlPodkategorija = (DropDownList)e.Row.FindControl("ddlPodkategorija"); ddlPodkategorija.DataSource = temp.getSelectPodKat(ddlKategorija.SelectedIndex + 1); ddlPodkategorija.DataValueField = "PodkatID"; ddlPodkategorija.DataTextField = "NazivPodkategorije"; ddlPodkategorija.DataBind(); ddlPodkategorija.SelectedValue = temp.getDefPK(Convert.ToInt32(GridView1.DataKeys[e.Row.RowIndex].Value)).FirstOrDefault().PodkategorijaID.ToString(); } } } }
protected void grvList_RowDataBound(object sender, GridViewRowEventArgs e) { if(e.Row.RowType == DataControlRowType.DataRow) { //if (Avatar.ImageUrl.ToString().Equals("")) Avatar.ImageUrl = "/Uploads/Core/noimg.jpg"; } }
protected void GVUserGroup_RowDataBound(object sender, GridViewRowEventArgs e) { if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == DataControlRowState.Alternate))) { ((LinkButton)e.Row.Cells[5].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('删除该组,将会删除以下内容:\\n1、该组下所有考生\\n2、该组所有考生的考试记录!\\n3、该组所有考生的练习记录!\\n4、该组所有考生的错题记录!\\n\\n\\n你确认要删除组:\"" + e.Row.Cells[1].Text + "\"吗?')"); } }
protected void gvScore_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //����ƶ���ÿ��ʱ��ɫ����Ч�� e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); //�����������ָ����״Ϊ"С��" e.Row.Attributes["style"] = "Cursor:hand"; if (!Convert.IsDBNull(gvScore.DataKeys[e.Row.RowIndex].Value)) { int tesid = Convert.ToInt32(gvScore.DataKeys[e.Row.RowIndex].Value); NurseScoreInfo ds = new NurseScoreInfo(tesid); if (ds.IsSubmit != 0) { Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; Button btnEdit = e.Row.FindControl("btnEdit") as Button; Button btnDelete = e.Row.FindControl("btnDelete") as Button; btnSubmit.Enabled = false; btnEdit.Enabled = false; btnDelete.Enabled = false; } } } }
// Advanced asset search ======================================================= protected void AssetSearchGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[0].Text = Server.HtmlDecode(e.Row.Cells[0].Text); } }
protected void uiGridViewHistory_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView row = (DataRowView)e.Row.DataItem; Label lblfrom = (Label)e.Row.FindControl("uiLabelFrom"); Label lblto = (Label)e.Row.FindControl("uiLabelTo"); Label lblstatus = (Label)e.Row.FindControl("uiLabelStatus"); AirPort airport = new AirPort(); airport.LoadByPrimaryKey(Convert.ToInt32(row["From_AirportID"].ToString())); lblfrom.Text = airport.IATACode; airport.LoadByPrimaryKey(Convert.ToInt32(row["To_AirportID"].ToString())); lblto.Text = airport.IATACode; TicketStatus Status = new TicketStatus(); if (!string.IsNullOrEmpty(row["TicketStatusID"].ToString())) { Status.LoadByPrimaryKey(Convert.ToInt32(row["TicketStatusID"].ToString())); if (Session["CurrentCulture"].ToString() == "ar-EG") lblstatus.Text = Status.ArName; else lblstatus.Text = Status.EnName; } } }
protected void gvPCMember_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.Controls.Count == 8) { if (e.Row.RowType == DataControlRowType.Header) { myHelpers.RenameGridViewColumn(e, "PCCODE", "PC CODE"); myHelpers.RenameGridViewColumn(e, "PERSONNAME", "NAME"); myHelpers.RenameGridViewColumn(e, "PHONENO", "PHONE NO"); myHelpers.RenameGridViewColumn(e, "PERSONEMAIL", "EMAIL"); } } }
protected void GridView1_RowCreated(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onmouseover"] = "this.style.cursor='pointer';this.style.textDecoration='underline';"; e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';"; e.Row.ToolTip = "Click to select row"; if (!(e.Row.RowIndex == GridView1.SelectedIndex)) { e.Row.Attributes["onclick"] = this.Page.ClientScript.GetPostBackClientHyperlink(this.GridView1, "Select$" + e.Row.RowIndex); } } }
protected void gvdtl_RowCreated(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Pager) { e.Row.Cells[0].Visible = true; } if (e.Row.RowType == DataControlRowType.DataRow | e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[0].Visible = false; e.Row.Cells[1].Visible = false; e.Row.Cells[2].Visible = false; } }
protected void grdAnalMethod_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow && Session["OrgID"] != null) { if (e.Row.Cells[2].Text != Session["OrgID"].ToString()) { ImageButton ib = (ImageButton)e.Row.FindControl("EditButton"); ib.Visible = false; ImageButton ib2 = (ImageButton)e.Row.FindControl("DelButton"); ib2.Visible = false; } } }
private void grdSKU_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == System.Web.UI.WebControls.DataControlRowType.DataRow) { System.Web.UI.WebControls.Literal literal = e.Row.FindControl("litUseAttributeImage") as System.Web.UI.WebControls.Literal; if (literal.Text == "True") { literal.Text = "图"; return; } literal.Text = "文"; } }
protected void gReleventPeople_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if ((e.Row.DataItem as PersonRelationship).Highlight) { foreach (TableCell cell in e.Row.Cells) { cell.BackColor = System.Drawing.Color.FromArgb(150, 200, 150); } } } }
/// <summary> /// Handles the RowDataBound event of the gBlockTypeAttributes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewRowEventArgs"/> instance containing the event data.</param> protected void gBlockTypeAttributes_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.DataItem != null) { bool isDynamicAttribute = (bool)e.Row.DataItem.GetPropertyValue("IsDynamicAttribute"); if (!isDynamicAttribute) { // don't allow static attributes on to be edited or deleted (but reordering them is OK) e.Row.Cells.OfType <DataControlFieldCell>().First(a => a.ContainingField is EditField).Controls[0].Visible = false; e.Row.Cells.OfType <DataControlFieldCell>().First(a => a.ContainingField is DeleteField).Controls[0].Visible = false; } } }
protected void dgvGridView_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { DataControlRowType itemType = e.Row.RowType; switch (itemType) { case DataControlRowType.DataRow: string strID = dgvGridView.DataKeys[e.Row.RowIndex].Values[0].ToString(); CheckBox chk = (CheckBox)e.Row.FindControl("chkSelectRow"); chk.Attributes.Add("OnClick", "javascript:SelectRow(this," + strID + ")"); break; } }
/// <summary> /// Grid绑定事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void grdProducts_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == System.Web.UI.WebControls.DataControlRowType.DataRow) { System.Web.UI.WebControls.Literal literal = (System.Web.UI.WebControls.Literal)e.Row.FindControl("litSaleStatus"); System.Web.UI.WebControls.Literal literal2 = (System.Web.UI.WebControls.Literal)e.Row.FindControl("litCostPrice"); System.Web.UI.WebControls.Literal literal3 = (System.Web.UI.WebControls.Literal)e.Row.FindControl("litRegionName"); System.Web.UI.WebControls.Literal literal4 = (System.Web.UI.WebControls.Literal)e.Row.FindControl("litSkuId"); if (literal.Text == "1") { literal.Text = "出售中"; } else { if (literal.Text == "2") { literal.Text = "下架区"; } else { literal.Text = "仓库中"; } } //if (string.IsNullOrEmpty(literal2.Text)) //{ // literal2.Text = "-"; //} if (!string.IsNullOrEmpty(literal3.Text)) { DataTable dtProductRegion = (DataTable)ViewState["dtProductRegion"]; DataRow[] drPr = dtProductRegion.Select(string.Format(@"ProductID = '{0}'", literal3.Text), "", DataViewRowState.CurrentRows); literal3.Text = string.Empty; foreach (DataRow dr in drPr) { literal3.Text += "<div style=\"float: left;\">" + dr["RegionName"].ToString() + "</div>\r\n"; } } if (!string.IsNullOrEmpty(literal4.Text) && ViewState["dtSkuItem"] != null) { DataTable dtSkuItems = (DataTable)ViewState["dtSkuItem"]; string strProductId = ((System.Data.DataRowView)(e.Row.DataItem)).Row["ProductId"].ToString(); DataRow[] dritems = dtSkuItems.Select(string.Format(@"SkuId = '{0}' and ProductId = '{1}'", literal4.Text, strProductId), "", DataViewRowState.CurrentRows); literal4.Text = string.Empty; foreach (DataRow dr in dritems) { literal4.Text += "<div style=\"float: left;\">" + dr["AttributeName"].ToString() + ":" + dr["ValueStr"].ToString() + "</div>\r\n"; } } } }
protected void GridView1_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((e.Row.RowState & DataControlRowState.Edit) > 0) { DropDownList ddlbr = new DropDownList(); ddlbr = (DropDownList)e.Row.FindControl("ddlBrick"); if (ddlbr != null) { ddlbr.DataSource = ds.Tables["Bricks"]; ddlbr.DataTextField = ds.Tables["Bricks"].Columns["AmounBrickName"].ColumnName.ToString(); ddlbr.DataValueField = ds.Tables["Bricks"].Columns["AmounBrickID"].ColumnName.ToString(); ddlbr.DataBind(); ((DropDownList)e.Row.FindControl("ddlBrick")).SelectedValue = DataBinder.Eval(e.Row.DataItem, "UBrick").ToString(); } DropDownList ddlNo = new DropDownList(); ddlNo = (DropDownList)e.Row.FindControl("ddlNoOfPatients"); if (ddlNo != null) { ddlNo.DataSource = ds.Tables["NoOfPatients"]; ddlNo.DataTextField = ds.Tables["NoOfPatients"].Columns["RangeName"].ColumnName.ToString(); ddlNo.DataValueField = ds.Tables["NoOfPatients"].Columns["RangeValue"].ColumnName.ToString(); ddlNo.DataBind(); ((DropDownList)e.Row.FindControl("ddlNoOfPatients")).SelectedValue = DataBinder.Eval(e.Row.DataItem, "UNoOfPatients").ToString(); } DropDownList ddlPH = new DropDownList(); ddlPH = (DropDownList)e.Row.FindControl("ddlPHabit"); if (ddlPH != null) { ddlPH.DataSource = ds.Tables["PHabit"]; ddlPH.DataTextField = ds.Tables["PHabit"].Columns["ShortName"].ColumnName.ToString(); ddlPH.DataValueField = ds.Tables["PHabit"].Columns["RangeValue"].ColumnName.ToString(); ddlPH.DataBind(); ((DropDownList)e.Row.FindControl("ddlPHabit")).SelectedValue = DataBinder.Eval(e.Row.DataItem, "UPHabit").ToString(); } } }
protected void GridView1_DataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { int total = 0; if (e.Row.RowType == DataControlRowType.DataRow) { total += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Amount_column")); } if (e.Row.RowType == DataControlRowType.Footer) { Label lblAmount = (Label)e.Row.FindControl("amountLabe"); lblAmount.Text = total.ToString(); } }
protected void GridviewOPSRegions_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((e.Row != null) && e.Row.RowType == DataControlRowType.DataRow) { int cellCount = this.GridviewOPSRegions.Columns.Count; int lastColumnIndex = cellCount - 1; LinkButton linkButtonDelete = (LinkButton)e.Row.Cells[lastColumnIndex].FindControl("LinkButtonDelete"); string uniqueId = linkButtonDelete.UniqueID; string opsRegion = Convert.ToString(e.Row.Cells[0].Text); string message = "Are you sure you want to delete the OPS Region " + opsRegion + " ?"; linkButtonDelete.Attributes.Add("onclick", "return ShowConfirm('" + uniqueId + "','" + message + "')"); } }
protected void GvOtoritasCabang_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { //menambahkan State Row on Hover if (e.Row.RowType == DataControlRowType.DataRow) { GridView gv = ((GridView)sender); String className = ((e.Row.RowState == DataControlRowState.Alternate) ? gv.AlternatingRowStyle.CssClass : gv.RowStyle.CssClass); e.Row.Attributes.Add("onmouseover", "this.className='datagrid_hovcol';"); e.Row.Attributes.Add("onmouseout", "this.className='" + className + "';"); } }
//Menyisipkan javascript untuk confirm sebelum delete protected void GvLembur_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { //menambahkan State Row on Hover if (e.Row.RowType == DataControlRowType.DataRow) { GridView gv = ((GridView)sender); String className = ((e.Row.RowState == DataControlRowState.Alternate) ? gv.AlternatingRowStyle.CssClass : gv.RowStyle.CssClass); e.Row.Attributes.Add("onmouseover", "this.className='datagrid_hovcol';"); e.Row.Attributes.Add("onmouseout", "this.className='" + className + "';"); ImageButton btnEdit = (ImageButton)e.Row.Cells[7].FindControl("imgEdit"); ImageButton btnDelete = (ImageButton)e.Row.Cells[8].FindControl("imgDelete"); Label lblTgl = (Label)e.Row.Cells[2].FindControl("lblCol2Item"); ImageButton btnSisip = (ImageButton)e.Row.Cells[9].FindControl("imgSisip"); Label lblLembur = (Label)e.Row.Cells[6].FindControl("lblCol6Item"); if (Session["GradeID"].ToString() != "1") { //CheckBox chkSelect = (CheckBox)e.Row.Cells[6].FindControl("chkSelect"); if (Session["GradeID"].ToString() != "2") { //chkSelect.Enabled = false; //btnEdit.Enabled = !chkSelect.Checked; //btnDelete.Enabled = !chkSelect.Checked; } } if (lblTgl != null) { btnEdit.Enabled = (DateTime.Parse(lblTgl.Text) > DateTime.Parse(Session["tglValidasiLembur"].ToString())); btnDelete.Enabled = (DateTime.Parse(lblTgl.Text) > DateTime.Parse(Session["tglValidasiLembur"].ToString())); btnSisip.Enabled = (DateTime.Parse(lblTgl.Text) > DateTime.Parse(Session["tglValidasiLembur"].ToString())); } if (lblLembur != null) { btnEdit.Visible = (lblLembur.Text != ""); btnDelete.Visible = (lblLembur.Text != ""); btnSisip.Visible = (lblLembur.Text == ""); } else { btnDelete.Visible = false; btnSisip.Visible = false; } } }
private void grdAuthorizeProducts_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == System.Web.UI.WebControls.DataControlRowType.DataRow) { int productId = System.Convert.ToInt32(this.grdAuthorizeProducts.DataKeys[e.Row.RowIndex].Value); System.Data.DataTable skusByProductIdByDistorId = ProductHelper.GetSkusByProductIdByDistorId(productId, this.distorUserId); Grid grid = (Grid)e.Row.FindControl("grdSkus"); if (grid != null) { grid.DataSource = skusByProductIdByDistorId; grid.DataBind(); } } }
protected void OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string customerId = gvCustomers.DataKeys[e.Row.RowIndex].Value.ToString(); GridView gvOrders = e.Row.FindControl("gvOrders") as GridView; gvOrders.ToolTip = customerId; gvOrders.DataSource = GetData(string.Format("select * from Orders where customer_id='{0}'", customerId)); gvOrders.DataBind(); //Expand the Child grid //ClientScript.RegisterStartupScript(GetType(), "Expand", "<SCRIPT LANGUAGE='javascript'>expandCollapse('div" + ((DataRowView)e.Row.DataItem)["id"].ToString() + "', 'one');</script>"); } }
protected void GRVEmployeeList_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (_presenter.ListEmployees(ddlEmployeeName.SelectedValue) != null) { if (e.Row.RowType == DataControlRowType.DataRow) { Employee emp = e.Row.DataItem as Employee; e.Row.Cells[5].Text = (Math.Round((emp.EmployeeLeaveBalanceYE() - _presenter.EmpLeaveTaken(emp.Id, emp.LeaveSettingDate.Value)) * 2, MidpointRounding.AwayFromZero) / 2).ToString(); e.Row.Cells[4].Text = emp.GetActiveContract() != null ? (Math.Round((emp.EmployeeLeaveBalanceCED(emp.GetActiveContract().ContractEndDate) - _presenter.EmpLeaveTaken(emp.Id, emp.LeaveSettingDate.Value)) * 2, MidpointRounding.AwayFromZero) / 2).ToString() : ""; e.Row.Cells[3].Text = (Math.Round((emp.EmployeeLeaveBalance() - _presenter.EmpLeaveTaken(emp.Id, emp.LeaveSettingDate.Value)) * 2, MidpointRounding.AwayFromZero) / 2).ToString(); e.Row.Cells[2].Text = _presenter.EmpLeaveTaken(emp.Id, emp.LeaveSettingDate.Value).ToString(); } } }
protected void grdCoupondsList_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == System.Web.UI.WebControls.DataControlRowType.DataRow) { System.Web.UI.WebControls.CheckBox checkBox = e.Row.FindControl("cbId") as System.Web.UI.WebControls.CheckBox; System.Web.UI.WebControls.Button button = e.Row.FindControl("lkDelete") as System.Web.UI.WebControls.Button; int num = Globals.ToNum(System.Web.UI.DataBinder.Eval(e.Row.DataItem, "ReceiveNum")); if (num > 0) { checkBox.Enabled = false; button.Enabled = false; } } }
protected void gv_ttts_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { foreach (GridViewRow rw in gv_ttts.Rows) { //txtbox_stts_caus; //txtbox_stts_ac; TextBox txtCaustic = (TextBox)rw.FindControl("txtbox_ttts_caus"); TextBox txt = (TextBox)rw.FindControl("txtbox_ttts_ac"); if (txtCaustic.Text == "") { //txt.Text = "0."; } } }
protected void gScheduledJobs_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { var site = RockPage.Site; if (e.Row.RowType == DataControlRowType.DataRow) { // format duration if (e.Row.DataItem.GetPropertyValue("LastRunDurationSeconds") != null) { int durationSeconds = 0; int.TryParse(e.Row.DataItem.GetPropertyValue("LastRunDurationSeconds").ToString(), out durationSeconds); TimeSpan duration = new TimeSpan(0, 0, durationSeconds); if (durationSeconds >= 60) { e.Row.Cells[3].Text = String.Format("{0:%m}m {0:%s}s", duration); } else { e.Row.Cells[3].Text = String.Format("{0:%s}s", duration); } } // format last status if (e.Row.DataItem.GetPropertyValue("LastStatus") != null) { string lastStatus = e.Row.DataItem.GetPropertyValue("LastStatus").ToString(); switch (lastStatus) { case "Success": e.Row.Cells[4].Text = "<span class='label label-success'>Success</span>"; break; case "Exception": e.Row.Cells[4].Text = "<span class='label label-danger'>Failed</span>"; break; case "": e.Row.Cells[4].Text = ""; break; default: e.Row.Cells[4].Text = String.Format("<span class='label label-warning'>{0}</span>", lastStatus); break; } } } }
protected void OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { //Kraschar allt /* if (e.Row.RowType == DataControlRowType.DataRow) * { * e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(shoppingCartGridView, "Select$" + e.Row.RowIndex); * * string onMouseOverStyle = "this.style.backgroundColor='yellow'"; * string onMouseOutStyle = "this.style.backgroundColor='transparent'"; * e.Row.Attributes.Add("onmouseover", onMouseOverStyle); * e.Row.Attributes.Add("onmouseout", onMouseOutStyle); * }*/ }
public void gvPreview_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { try { Label lbl = (Label)e.Row.Cells[0].FindControl("lblLine"); lbl.Text = e.Row.DataItem.ToString(); } catch { } } }
protected void gvCoffeeRequireByDay_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label _ByGroupTitleLabel = (Label)e.Row.FindControl("lblByGroupTitle"); Label _ByAbreviationLabel = (Label)e.Row.FindControl("lblByAbreviation"); Label _ByQtyLabel = (Label)e.Row.FindControl("lblByQty"); string _strByVal = String.Format("{0} ({1})", _ByGroupTitleLabel.Text, _ByAbreviationLabel.Text); double _dblByQty = Convert.ToDouble(_ByQtyLabel.Text); string _strByGroupTitle = (string)ViewState["GroupByTitle"]; double _dblByGroupTotal = (ViewState["GroupByTotal"] == null) ? 0 : (double)ViewState["GroupByTotal"]; if (_strByGroupTitle == _strByVal) { // calculate totals _dblByGroupTotal += _dblByQty; _ByGroupTitleLabel.Visible = false; _ByGroupTitleLabel.Text = string.Empty; } else { string _strHTML = ""; // Seperate Rows totals _strByGroupTitle = _strByVal; ViewState["GroupByTitle"] = _strByGroupTitle; _ByGroupTitleLabel.Visible = true; if (_dblByGroupTotal != 0) { _strHTML = String.Format("<b>Total</b></td><td colspan='2' align='right'><b>{0}</b></td>", _dblByGroupTotal); } else { _strHTML = "</td><td></td>"; } // now add the title // this is a header so move all goodies to the next row. _strHTML += "</tr><tr><td colspan='3'><b>Required Date (By)</b>: " + _strByGroupTitle + "</td></tr><tr><td>"; _ByGroupTitleLabel.Text = _strHTML; _dblByGroupTotal = _dblByQty; // add this quantity as it is the first one. } ViewState["GroupByTotal"] = _dblByGroupTotal; } else if (e.Row.RowType == DataControlRowType.Footer) { // Seperate Rows totals double _dblByGroupQty = (ViewState["GroupByTotal"] == null) ? 0 : (double)ViewState["GroupByTotal"]; Label _ByGroupFooterQty = (Label)e.Row.FindControl("lblByFooterQty"); _ByGroupFooterQty.Text = _dblByGroupQty.ToString(); } }
protected void grdViewHostInstancesMain_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "NoCheckMouseEvents(this, event)"); e.Row.Attributes.Add("onmouseout", "NoCheckMouseEvents(this, event)"); CheckBox chk = (CheckBox)e.Row.Cells[5].Controls[0]; //if (chk.Checked) // e.Row.Cells[5].BackColor = System.Drawing.Color.Red; } }
/// <summary> /// Handles the RowDataBound event of the gGroupMembers control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewRowEventArgs"/> instance containing the event data.</param> protected void gGroupMembers_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { dynamic groupMember = e.Row.DataItem; if (groupMember != null) { int groupMemberId = groupMember.Id; if (_groupMembersWithRegistrations.ContainsKey(groupMemberId)) { e.Row.AddCssClass("js-has-registration"); var lRegistration = e.Row.FindControl("lRegistration") as Literal; if (lRegistration != null) { var regLinks = new List <string>(); foreach (var reg in _groupMembersWithRegistrations[groupMemberId]) { regLinks.Add(string.Format("<a href='{0}'>{1}</a>", LinkedPageUrl("RegistrationPage", new Dictionary <string, string> { { "RegistrationId", reg.Key.ToString() } }), reg.Value)); } lRegistration.Text = regLinks.AsDelimited("<br/>"); } } if (groupMember != null && groupMember.IsDeceased) { e.Row.AddCssClass("is-deceased"); } if (_inactiveStatus != null && groupMember.RecordStatusValueId == _inactiveStatus.Id) { e.Row.AddCssClass("is-inactive-person"); } if (_inactiveStatus != null && groupMember.GroupMemberStatus == GroupMemberStatus.Inactive) { e.Row.AddCssClass("is-inactive"); } } } }
protected void grdAssignedRights_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { try { int intUserID = int.Parse(ddlUser.SelectedValue); using (ERP_CMSEntities cntx = new ERP_CMSEntities()) { if (e.Row.RowType == DataControlRowType.DataRow) { // Dim rptInnerRights As Repeater = e.Row.FindControl("rptInnerRights") GridView grdInnerRights = (GridView)e.Row.FindControl("grdAssignedRightsInner"); int intMenuLinkID = int.Parse(((HiddenField)e.Row.FindControl("hdnMenuLinkID")).Value); var obj = cntx.sp_GetPageRightsByUserAndMenuLinkID(intUserID, intMenuLinkID).ToList(); if (obj.Count > 0) { // rptInnerRights.DataSource = obj // rptInnerRights.DataBind() grdInnerRights.DataSource = obj; grdInnerRights.DataBind(); foreach (GridViewRow row in grdInnerRights.Rows) { CheckBox chkInner = (CheckBox)row.FindControl("chkInnerLink"); Label lblMenuLinkTextInner = (Label)row.FindControl("lblMenuLinkTextInner"); int hdnEmpRightID = int.Parse(((HiddenField)row.FindControl("hdnEmpRightID")).Value); if (hdnEmpRightID > 0) { chkInner.Checked = true; } else { chkInner.Checked = false; } } } else { // rptInnerRights.DataSource = Nothing // rptInnerRights.DataBind() grdInnerRights.DataSource = null; grdInnerRights.DataBind(); } } } } catch (Exception ex) { } }
protected void gvPayoutItem_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { switch (e.Row.RowType) { case DataControlRowType.DataRow: //DataRowView ud_drvItem = (DataRowView)e.Row.DataItem; //Label ud_lblPayoutCashMoney = (Label)e.Row.FindControl("lblPayoutCashMoney"); //string ud_sPaymentMoneyType = ud_drvItem["PaymentMoneyType"] == DBNull.Value ? string.Empty : ud_drvItem["PaymentMoneyType"].ToString(); //string ud_sPayoutMoneyType = ud_drvItem["PayoutMoneyType"] == DBNull.Value ? ud_sPaymentMoneyType : ud_drvItem["PayoutMoneyType"].ToString(); break; } }
public void gvList_OnNonconfRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { try { Label lbl = (Label)e.Row.Cells[0].FindControl("lblStatus_out"); HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfStatus_out"); lbl.Text = WebSiteCommon.GetStatusString(hf.Value); } catch { } } }
protected void gvSchedSummary_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } if (e.Row.RowType == System.Web.UI.WebControls.DataControlRowType.DataRow) { ScheduledEvent se = (ScheduledEvent)e.Row.DataItem; Controls_popmenu pop = (Controls_popmenu)e.Row.FindControl("popmenu"); ((HyperLink)pop.FindControl("lnkDownloadICS")).NavigateUrl = String.Format(CultureInfo.InvariantCulture, "~/Member/IcalAppt.aspx?c={0}&sid={1}", ClubID, se.ID); ((HyperLink)pop.FindControl("lnkDownloadYahoo")).NavigateUrl = String.Format(CultureInfo.InvariantCulture, "~/Member/IcalAppt.aspx?c={0}&sid={1}&fmt=Y", ClubID, se.ID); ((HyperLink)pop.FindControl("lnkDownloadGoogle")).NavigateUrl = String.Format(CultureInfo.InvariantCulture, "~/Member/IcalAppt.aspx?c={0}&sid={1}&fmt=G", ClubID, se.ID); } }
protected void gvSample_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton btnDelete = (LinkButton)e.Row.FindControl("btnDelete"); LinkButton btnEdit = (LinkButton)e.Row.FindControl("btnEdit"); //LinkButton btnView = (LinkButton)e.Row.FindControl("btnView"); if (btnDelete != null) { btnDelete.Visible = !(this.CommandName == CommandNameEnum.View); btnEdit.Visible = !(this.CommandName == CommandNameEnum.View); } } }