protected void gvACC_EmployPayRoleSalary_OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblStatus = (Label)e.Row.FindControl("lblStatus"); Label lblID = (Label)e.Row.FindControl("lblID"); TextBox txtSalaryAmount = (TextBox)e.Row.FindControl("txtSalaryAmount"); ACC_EmployPayRoleSalary employPayRoleSalary = ACC_EmployPayRoleSalaryManager.GetEmployPayRoleSalaryByID(Convert.ToInt32(lblID.Text)); if (employPayRoleSalary.Status == (int)Enums.SalaryStatus.Paid) { lblStatus.Text = "Paid"; txtSalaryAmount.Enabled = false; } else if (employPayRoleSalary.Status == (int)Enums.SalaryStatus.PartiallyPaid) { lblStatus.Text = "Partially Paid"; } else { lblStatus.Text = "UnPaid"; } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[2].ToolTip = e.Row.Cells[2].Text; if ((e.Row.Cells[2].Text).Length > 20) { e.Row.Cells[2].Text = (e.Row.Cells[2].Text).Substring(0, 20) + "..."; } if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate) { ((LinkButton)e.Row.Cells[4].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('你确认要删除吗?')"); } } //首先判断是否是数据行 if (e.Row.RowType == DataControlRowType.DataRow) { //当鼠标停留时更改背景色 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='Aqua'"); //当鼠标移开时还原背景色 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c"); } }
// 每列資料的處理 protected void gv_Ts_QU_RowDataBound(object sender, GridViewRowEventArgs e) { string tq_type = "", tq_sid = "", tq_sort ="", tq_desc = "", tuq_score = ""; if ((e.Row.RowType == DataControlRowType.DataRow)) { tq_sort = DataBinder.Eval(e.Row.DataItem, "tq_sort").ToString(); tq_desc = DataBinder.Eval(e.Row.DataItem, "tq_desc").ToString(); tq_type = DataBinder.Eval(e.Row.DataItem, "tq_type").ToString(); tuq_score = DataBinder.Eval(e.Row.DataItem, "tuq_score").ToString(); if (tuq_score == "0") e.Row.Cells[0].Text = "<font color=red><b>╳</b></font>"; else e.Row.Cells[0].Text = "○"; if (tq_type == "0") e.Row.Cells[4].Text = "單選"; else if (tq_type == "1") e.Row.Cells[4].Text = "複選全部"; else e.Row.Cells[4].Text = "複選 " + tq_type + " 題"; Literal lt_temp = (Literal)e.Row.Cells[3].FindControl("lt_tq_desc"); tq_sid = DataBinder.Eval(e.Row.DataItem, "tq_sid").ToString(); lt_temp.Text = Get_Item(lb_tp_sid.Text, tq_sid, tq_type, tq_sort, tq_desc); } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex != -1) { if (((HiddenField)(e.Row.FindControl("HiddenField1"))).Value == "DarhalBargozari") { ((HyperLink)(e.Row.FindControl("HyperLink1"))).Visible = true; } else { ((HyperLink)(e.Row.FindControl("HyperLink1"))).Visible = false; } if (((HiddenField)(e.Row.FindControl("HiddenField1"))).Value == "BargozarShode") { int ID_Test=int.Parse( ((Label)(e.Row.FindControl("lblID"))).Text); DataTable dt = new tbl_TestResultTableAdapter().GetDataByScoreStudent(ID_Test, int.Parse(Request.Cookies["ID_Role"].Value)); if (dt.Rows.Count > 0) { ((Label)(e.Row.FindControl("lblScore"))).Text = dt.Rows[0]["tr_Score"].ToString(); } else { ((Label)(e.Row.FindControl("lblScore"))).Text = ""; } } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { //if (GridView1.SelectedIndex<0) return; //Debug.WriteLine(GridView1.SelectedIndex); //Flight f = (Flight)GridView1.SelectedRow.DataItem; //Session["flightEdit"] = f; }
protected void grdusrtype_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow && e.Row.DataItem != null) { try { GridViewRow gr = e.Row; Label lblCategoryname = (Label)gr.FindControl("lblusertype"); HiddenField HDFID = (HiddenField)gr.FindControl("HDFusertypeID"); ImageButton IMGBTNcategoryisActive = (ImageButton)gr.FindControl("IMGBTNusertypeisActive"); UserType u = e.Row.DataItem as UserType; lblCategoryname.Text = u.UserType.ToString(); HDFID.Value = u.Id.ToString(); if (u.IsActive == true) { IMGBTNcategoryisActive.ImageUrl = "~/images/tick.png"; } else IMGBTNcategoryisActive.ImageUrl = "~/images/close.jpg"; } catch (Exception ex) { Response.Write(ex.ToString()); } } }
protected void GVData_RowDataBound(object sender, GridViewRowEventArgs e) { ZWL.Common.PublicMethod.GridViewRowDataBound(e); //�ж�����÷� if (e.Row.RowType == DataControlRowType.DataRow) { Label LabID = (Label)e.Row.FindControl("LabVisible"); //����ID Label Labz = (Label)e.Row.FindControl("Label1");//�ܷ� Label Labd = (Label)e.Row.FindControl("Label2");//���� Label Labr = (Label)e.Row.FindControl("Label3");//�˹� Labz.Text = ZWL.DBUtility.DbHelperSQL.GetSHSLInt("select sum(DeFen) from ERPTiKuKaoShiJieGuo where DeFen is not null and KaoShiID=" + LabID.Text.ToString()); Labd.Text = ZWL.DBUtility.DbHelperSQL.GetSHSLInt("select sum(DeFen) from ERPTiKuKaoShiJieGuo where TiMuID not in (select ID from ERPTiKu where FenLeiStr='�����') and DeFen is not null and KaoShiID=" + LabID.Text.ToString()); Labr.Text = ZWL.DBUtility.DbHelperSQL.GetSHSLInt("select sum(DeFen) from ERPTiKuKaoShiJieGuo where TiMuID in (select ID from ERPTiKu where FenLeiStr='�����') and DeFen is not null and KaoShiID=" + LabID.Text.ToString()); } //�ж��Ƿ���Ȩ�� if (e.Row.RowType == DataControlRowType.DataRow) { HyperLink MyHyp = (HyperLink)e.Row.FindControl("HyperLink2"); MyHyp.Visible = ZWL.Common.PublicMethod.StrIFIn("|047N|", ZWL.Common.PublicMethod.GetSessionValue("QuanXian")); } }
protected void CustomersGridView_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { } }
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var h = (VDMS.WebService.Entity.OrderInfo)e.Row.DataItem; ((HyperLink)e.Row.FindControl("h1")).NavigateUrl = string.Format("OrderEdit.aspx?id={0}&action=edit", h.OrderHeaderId); ((HyperLink)e.Row.FindControl("h3")).NavigateUrl = string.Format("OrderView.aspx?id={0}&TB_iframe=true&height=320&width=420", h.OrderHeaderId); var canEdit = false; if (h.Status == OrderStatus.OrderOpen || (h.Status == OrderStatus.OrderSent && h.TipTopProcessed != "Y")) canEdit = true; if (!canEdit) { e.Row.Cells[0].Controls[0].Visible = false; e.Row.Cells[0].Controls[1].Visible = false; e.Row.Cells[0].Controls[2].Visible = false; e.Row.Cells[0].Controls[3].Visible = false; e.Row.Cells[7].Controls.Clear(); } if (h.Status != OrderStatus.OrderOpen) e.Row.Cells[7].Controls.Clear(); if (h.OrderSource != "V") { e.Row.Cells[0].Controls[2].Visible = false; e.Row.Cells[0].Controls[3].Visible = false; } } }
protected void gv_ListDetail_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int applydetailid = (int)gv_ListDetail.DataKeys[e.Row.RowIndex]["FNA_FeeWriteOffDetail_ApplyDetailID"]; if (applydetailid > 0) { Label lb_ApplySheetCode = (Label)e.Row.FindControl("lb_ApplySheetCode"); if (lb_ApplySheetCode != null) lb_ApplySheetCode.Text = FNA_FeeApplyBLL.GetSheetCodeByDetailID(applydetailid); Label lb_RelateBrand = (Label)e.Row.FindControl("lb_RelateBrand"); if (lb_RelateBrand != null) { string[] brands = new FNA_FeeApplyBLL().GetDetailModel(applydetailid).RelateBrands.Split (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); lb_RelateBrand.Text = ""; foreach (string b in brands) { lb_RelateBrand.Text += new PDT_BrandBLL(int.Parse(b)).Model.Name + ","; } } } } }
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.Header) { GridView gv3 = sender as GridView; GridViewRow row3 = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal); Table t3 = (Table)gv3.Controls[0]; TableCell FileDateb1 = new TableHeaderCell(); FileDateb1.Text = "<b>Center Name:</b> " + DropDownList4.SelectedItem.Text + " | <b>Course:</b> " + DropDownList2.SelectedItem.Text + " | <b> Period:</b> " + Convert.ToDateTime(TextBox1.Text).ToString("dd MMM, yyyy") + " to " + Convert.ToDateTime(TextBox2.Text).ToString("dd MMM, yyyy"); FileDateb1.ColumnSpan = GridView1.Columns.Count; FileDateb1.Height = 50; FileDateb1.Font.Size = 15; FileDateb1.Font.Bold = true; row3.Cells.Add(FileDateb1); t3.Rows.AddAt(0, row3); } } catch { } }
protected void GVQuestionnaire_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { RadioButtonList rdoAnswer = (RadioButtonList)e.Row.FindControl("rdoListAnswer"); if (rdoAnswer != null) { rdoAnswer.Items.Clear(); if (DataBinder.Eval(e.Row.DataItem, "ChrDisplayYes").ToString().Equals("Y")) { rdoAnswer.Items.Add(new ListItem("Yes", "Yes")); rdoAnswer.SelectedIndex = 0; } if (DataBinder.Eval(e.Row.DataItem, "ChrDisplayNo").ToString().Equals("Y")) { rdoAnswer.Items.Add(new ListItem("No", "No")); } if (DataBinder.Eval(e.Row.DataItem, "ChrDisplayDontKnow").ToString().Equals("Y")) { rdoAnswer.Items.Add(new ListItem("Don't Know", "DontKnow")); } } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { GridViewRow row = e.Row; if (row.RowType == DataControlRowType.DataRow) { Label lblSNO = (Label)e.Row.FindControl("lblSNo"); if (lblSNO != null) { lblSNO.Text = ((((GridView)e.Row.Parent.Parent).PageIndex) * ((GridView)e.Row.Parent.Parent).PageSize + e.Row.RowIndex + 1).ToString(); } string CellValue = Convert.ToString(e.Row.Cells[2].Text); switch (CellValue) { case "G": e.Row.Cells[2].Text = "General"; break; case "S": e.Row.Cells[2].Text = "Shop"; break; case "A": e.Row.Cells[2].Text = "Admin"; break; default: e.Row.Cells[2].Text = "General"; break; } } }
protected void gdvcolor_RowDataBound(object sender, GridViewRowEventArgs e) { int i; //执行循环,保证每条数据都可以更新 for (i = -1; i < gdvcolor.Rows.Count; i++) { //首先判断是否是数据行 if (e.Row.RowType == DataControlRowType.DataRow) { //当鼠标停留时更改背景色 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#999999'"); // 当鼠标移开时还原背景色 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c"); } } //如果是绑定数据行 删除时弹出对话框 if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate) { ((LinkButton)e.Row.Cells[3].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('你确认要删除" + e.Row.Cells[1].Text + "吗?')"); } } }
protected void gvExaminationInfo_RowDataBound(object sender, GridViewRowEventArgs e) { for (int i = 0; i < gvExaminationInfo.Rows.Count; i++) { gvExaminationInfo.Rows[i].Cells[3].Attributes.Add("onclick", "return confirm('确定要删除吗?')"); } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { sr++; } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex <= -1) return; LinkButton imgbtnDelete = e.Row.FindControl("btnDelete") as LinkButton; imgbtnDelete.Attributes.Add("onclick", "return confirm('您确认要删除这条记录?');"); }
protected void gridGAC_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.Cells.Count > 3) { // Last modified on is in Column - 3, index starts at 0. int compare = System.DateTime.Compare(DateTime.Parse(e.Row.Cells[2].Text), System.DateTime.Today); if (compare > 0) { System.Web.UI.WebControls.Image tickImage = new System.Web.UI.WebControls.Image(); tickImage.ImageUrl = "~/Images/tick-circle-frame-icon.png"; tickImage.ToolTip = "This DLL was installed into GAC today."; e.Row.Cells[0].Controls.Add(tickImage); e.Row.Cells[1].ForeColor = Color.Teal; e.Row.Cells[2].ForeColor = Color.Teal; e.Row.Cells[3].ForeColor = Color.Teal; } } if (e.Row.Cells.Count > 0) { if (e.Row.Cells[0].Text.Contains(identifier)) { e.Row.Cells[0].ForeColor = Color.Red; e.Row.Cells[1].ForeColor = Color.Red; e.Row.Cells[2].ForeColor = Color.Red; e.Row.Cells[3].ForeColor = Color.Red; } } } }
protected void gdv_OutLoadWeight_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onclick", "RowClickSingle(this,'gdv_OutLoadWeight');"); } }
protected void grdResult_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { HiddenField hdnstatus = (HiddenField)e.Row.FindControl("hdnstatus"); LinkButton lnkactive = (LinkButton)e.Row.FindControl("lnkactive"); if (hdnstatus.Value == "1") { e.Row.BackColor = System.Drawing.Color.Green; lnkactive.Text = "Disabled"; } else if (hdnstatus.Value == "0") { e.Row.BackColor = System.Drawing.Color.Red; lnkactive.Text = "Enabled"; } else { e.Row.BackColor = System.Drawing.Color.Orange; } } //if ((objAdmin.strExpert == false) && (hld.Contains("0 received") || hld.Contains("Received = 0"))) //if (hld.Contains("0 received") || hld.Contains("Received = 0")) // e.Item.BackColor = System.Drawing.Color.Red; //else // if ((objAdmin.strExpert == true) && (!hld.Contains("0 received") || !hld.Contains("Received = 0"))) // e.Item.BackColor = System.Drawing.Color.Green; // else // if ((objAdmin.strExpert == false) && (hld.Contains("0 received") || hld.Contains("Received = 0"))) // e.Item.BackColor = System.Drawing.Color.Red; //} }
protected void OnGridCandidateDocument_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Lucene.Net.Documents.Document doc = e.Row.DataItem as Lucene.Net.Documents.Document; if(doc != null) { HyperLink lnkCandidateID = (HyperLink)e.Row.FindControl("lnkCandidateID"); if(lnkCandidateID != null) { Candidate candidate = new CandidateRepository().FindOne(new Candidate(Convert.ToInt32(doc.Get("candidateID")))); if (candidate != null) { lnkCandidateID.Text = string.Format("{0} {1}", candidate.FirstName, candidate.LastName); lnkCandidateID.NavigateUrl = string.Format("~/CandidateProfile.aspx?CandidateID={0}&mode=edit", candidate.CandidateId); } } Literal lblCandidateContent = (Literal)e.Row.FindControl("lblCandidateContent"); if (lblCandidateContent != null) { lblCandidateContent.Text = Common.FirstWords(doc.Get("content"), 50); } HyperLink lnkCandidateCV = (HyperLink)e.Row.FindControl("lnkCandidateCV"); if (lnkCandidateCV != null) { lnkCandidateCV.Text = doc.Get("path"); lnkCandidateCV.NavigateUrl = doc.Get("path"); } } } }
protected void gvRespuestas_RowCreated(object sender, GridViewRowEventArgs e) { //Oculto las columnas de códigos if (e.Row.Cells.Count > 1) e.Row.Cells[1].Visible = false; }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[2].ToolTip = e.Row.Cells[2].Text; if ((e.Row.Cells[2].Text).Length > 30) { e.Row.Cells[2].Text = (e.Row.Cells[2].Text).Substring(0, 30) + "..."; } if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate) { ((LinkButton)e.Row.Cells[4].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('��ȷ��Ҫɾ��\"" + e.Row.Cells[2].Text + "\"��?')"); } } int i; //ִ��ѭ������֤ÿ�����ݶ����Ը��� for (i = 0; i < GridView1.Rows.Count; i++) { //�����ж��Ƿ��������� if (e.Row.RowType == DataControlRowType.DataRow) { //�����ͣ��ʱ���ı���ɫ e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='Aqua'"); //������ƿ�ʱ��ԭ����ɫ e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c"); } } }
protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e) { GridView gv = (GridView)sender; if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView drv = ((DataRowView)e.Row.DataItem); t01_entidade t01 = new t01_entidade(); { t01.t01_cd_entidade = (int)drv["t01_cd_entidade"]; t01.Retrieve(); if (!t01.Found) { t05_parceiro t05 = new t05_parceiro(); { t05.t05_cd_parceiro = (int)drv["t05_cd_parceiro"]; t05.Retrieve(); if (t05.Found) { t01.t01_cd_entidade = t05.t01_cd_entidade; t01.Retrieve(); if (t01.Found) { e.Row.Cells[2].Controls.Add(pb.GetLiteral(t01.nm_entidade + "\\" + t05.nm_parceiro)); } } } } } } }
protected void gv1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { BindItem(e); } }
private void BindItem(GridViewRowEventArgs e) { int cid = Uc.CategoryID; int sid = Uc.ServiceID; TaskE task = (TaskE)UWeb.ToInt32(e, "TaskID"); ServiceCategory sc = new ServiceCategory(Cxt, sid, cid); HyperLink lnkt = e.Row.FindControl("lnkt") as HyperLink; switch (task) { case TaskE.SearchItem: lnkt.Text = sc.Get(AttributeE.CategorySearchLabel, Category.DefaultSearch); lnkt.NavigateUrl = UWeb.GetUrlItemSearch(Uc.ServiceID, cid, SearchTypeE.Quick); break; case TaskE.NewItem: lnkt.Text = sc.Get(AttributeE.CategoryNewLabel, Category.DefaultNew); lnkt.NavigateUrl = UWeb.GetUrlItemEdit(Uc.ServiceID, LayoutE.Edit, cid, Uc.ItemID); break; case TaskE.BrowseItem: lnkt.Text = sc.Get(AttributeE.CategoryBrowseLabel, Category.DefaultBrowse); lnkt.NavigateUrl = UWeb.GetUrlItemSearch(Uc.ServiceID, cid, SearchTypeE.Browse); break; case TaskE.MyItem: lnkt.Text = sc.Get(AttributeE.CategoryMyItemsLabel, Category.DefaultMyItems); lnkt.NavigateUrl = UWeb.GetUrlItemSearch(Uc.ServiceID, cid, SearchTypeE.MyItems); break; } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblReview = (Label)e.Row.FindControl("Label1"); string tooltip = lblReview.Text; e.Row.Cells[0].Attributes.Add("title", tooltip); Label lblReview2 = (Label)e.Row.FindControl("Label2"); string tooltip2 = lblReview2.Text; e.Row.Cells[1].Attributes.Add("title", tooltip2); Label lblReview3 = (Label)e.Row.FindControl("Label3"); string tooltip3 = lblReview3.Text; e.Row.Cells[2].Attributes.Add("title", tooltip3); Label lblReview4 = (Label)e.Row.FindControl("Label4"); string tooltip4 = lblReview4.Text; e.Row.Cells[3].Attributes.Add("title", tooltip4); Label lblReview5 = (Label)e.Row.FindControl("Label5"); string tooltip5 = lblReview5.Text; e.Row.Cells[4].Attributes.Add("title", tooltip5); Label lblReview6 = (Label)e.Row.FindControl("Label6"); string tooltip6 = lblReview6.Text; e.Row.Cells[5].Attributes.Add("title", tooltip6); } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate) { ((LinkButton)e.Row.Cells[3].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('你确认要删除:\"" + e.Row.Cells[1].Text + "\"吗?')"); } //当鼠标放上去的时候 先保存当前行的背景颜色 并给附一颜色 e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#C9D3E2',this.style.fontWeight='';"); //当鼠标离开的时候 将背景颜色还原的以前的颜色 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';"); e.Row.Attributes["style"] = "Cursor:pointer"; e.Row.Cells[1].Attributes.Add("style", "vnd.ms-excel.numberformat:@;");//跳转页 } } catch (Exception ex) { Console.Write(ex.Message);//显示错误原因。 } }
protected void gvVideos_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { try { string pattern = @"(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^""&?\/ ]{11})$"; VideoTemplate vidTmp = (VideoTemplate)e.Row.FindControl("vidTmp"); DataRowView row = (DataRowView)e.Row.DataItem; string video_url = Regex.Match(row.Row["video_url"].ToString(), pattern).Groups[1].Value.ToString(); Label lblTitle = (Label)vidTmp.FindControl("LabelTitle"); HtmlControl player = (HtmlControl)vidTmp.FindControl("player"); player.Attributes["src"] = "http://www.youtube.com/embed/" + video_url + "?enablejsapi=1"; lblTitle.Text = row.Row["title"].ToString() + "<br/><h3>Објавенo: " + row.Row["date"].ToString() + "</h3>"; } catch (Exception err) { lblError.Text = err.Message; } } }
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { e.Row.Cells[9].Visible = false; e.Row.Cells[10].Visible = false; }
protected void Rules_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { String id = Rules.DataKeys[e.Row.RowIndex].Value.ToString(); PackageRule rule = Settings.CostingRules[id]; Int32 rowIndex = (Rules.PageIndex * Rules.PageSize) + e.Row.RowIndex; if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate) { if (rowIndex == Settings.CostingRules.Count - 1) { e.Row.FindControl("DeleteRow").Visible = false; e.Row.FindControl("MoveRuleUp").Visible = false; e.Row.FindControl("MoveRuleDown").Visible = false; } if (rowIndex == Settings.CostingRules.Count - 2) { e.Row.FindControl("MoveRuleDown").Visible = false; } if (rowIndex == 0) { e.Row.FindControl("MoveRuleUp").Visible = false; } } else if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit) { DropDownList packagePropertyList = (DropDownList)e.Row.FindControl("ValuePackagePropertyField"); DropDownList itemPropertyList = (DropDownList)e.Row.FindControl("ValueItemPropertyField"); DropDownList customPropertyList = (DropDownList)e.Row.FindControl("ValueCustomPropertyField"); HelpLabel customPropertyLabel = (HelpLabel)e.Row.FindControl("ValueCustomPropertyLabel"); Label multiplierLabel = (Label)e.Row.FindControl("ValueMultiplierLabel"); HelpLabel valueLabel = (HelpLabel)e.Row.FindControl("ValueLabel"); TextBox valueField = (TextBox)e.Row.FindControl("ValueField"); BaseValidator valueRequired = (BaseValidator)e.Row.FindControl("ValueRequired"); BaseValidator valueNumeric = (BaseValidator)e.Row.FindControl("ValueNumeric"); packagePropertyList.Items.Clear(); packagePropertyList.Items.AddRange(GetPackageProperties()); itemPropertyList.Items.Clear(); itemPropertyList.Items.AddRange(GetItemProperties()); itemPropertyList.Visible = false; if (rule.ValuePackageProperty == PackageProperties.ItemProperty) { itemPropertyList.Visible = true; PrepareCustomPropertyField(customPropertyLabel, customPropertyList, rule.ValueItemProperty); PrepareValueField(multiplierLabel, valueLabel, valueField, valueRequired, valueNumeric, rule.ValueItemProperty); } else { PrepareCustomPropertyField(customPropertyLabel, customPropertyList, rule.ValuePackageProperty); PrepareValueField(multiplierLabel, valueLabel, valueField, valueRequired, valueNumeric, rule.ValuePackageProperty); } if (customPropertyList.Items.Count == 0) { customPropertyList.Items.Add(new ListItem("", rule.ValueCustomProperty)); } if (customPropertyList.Items.FindByValue(rule.ValueCustomProperty) == null) { rule.ValueCustomProperty = customPropertyList.Items[0].Value; } } } }
protected void gridFADN_RowDataBound(object sender, GridViewRowEventArgs e) { DataTable mostra = new DataTable(); mostra = boton.BotonReadUsuario(Session["Usuario"].ToString(), "C2"); if (e.Row.RowType == DataControlRowType.DataRow) { gridFADN.Columns[0].Visible = true; (e.Row.FindControl("btEditar") as LinkButton).Visible = false; (e.Row.FindControl("btVer") as LinkButton).Visible = false; (e.Row.FindControl("btEliminar") as LinkButton).Visible = false; (e.Row.FindControl("btObservacion") as LinkButton).Visible = false; (e.Row.FindControl("btAprobar") as LinkButton).Visible = false; (e.Row.FindControl("btEnviar") as LinkButton).Visible = false; if (int.Parse(e.Row.Cells[0].Text) > 0) { for (int j = 0; j < mostra.Rows.Count; j++) { switch (mostra.Rows[j][0].ToString()) { case "Guardar": break; case "Editar": if (pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 2) { (e.Row.FindControl("btEditar") as LinkButton).Visible = true; } break; case "Ver": if (obs.ObservacionCEFADNExiste(int.Parse(e.Row.Cells[0].Text), 6) == true || obs.ObservacionAcompaniamientoExiste(int.Parse(e.Row.Cells[0].Text), 6) == true || obs.ObservacionEvaluadorExiste(int.Parse(e.Row.Cells[0].Text), 6) == true) { (e.Row.FindControl("btVer") as LinkButton).Visible = true; } break; case "Eliminar": if (pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 1 || pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 2) { (e.Row.FindControl("btEliminar") as LinkButton).Visible = true; } break; case "Enviar": if (pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 1 || pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 2 || pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 3 || pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 6 || pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 9) { (e.Row.FindControl("btEnviar") as LinkButton).Visible = true; } break; case "Aprobar": if (pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 3 || pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 9) { (e.Row.FindControl("btAprobar") as LinkButton).Visible = true; } break; case "Observación": if (pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 3 || pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 6 || pat.C2Estado(int.Parse(e.Row.Cells[0].Text)) == 9) { (e.Row.FindControl("btObservacion") as LinkButton).Visible = true; } break; } } } } }
protected void grdItemSubCategory_RowDataBound(object sender, GridViewRowEventArgs e) { e.Row.Cells[0].Visible = false; e.Row.Cells[1].Visible = false; e.Row.Cells[4].Visible = false; }
protected void GridExp_RowDataBound(object sender, GridViewRowEventArgs e) { RowBound(e); }
protected void GVData_RowDataBound(object sender, GridViewRowEventArgs e) { ZWL.Common.PublicMethod.GridViewRowDataBound(e); }
protected void cancerGridView_RowDataBound(object source, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { for (int _i = 0; _i < e.Row.Cells.Count; _i++) { System.Web.UI.WebControls.TableHeaderCell hc = new TableHeaderCell(); hc.ID = cancerTbl.Columns[_i].ColumnName.Replace(" ", string.Empty); if (CECWebSrv.IsCohort(UserToken, e.Row.Cells[_i].Text)) { DataRow dr_cohort = null; using (DataTable dt = CECWebSrv.GetFilteredCohortRecords(UserToken, "cohort_id, cohort_name, cohort_acronym", String.Format("cohort_acronym='{0}'", cancerTbl.Columns[_i].ColumnName)).Tables[0]) dr_cohort = dt.Rows[0]; System.Web.UI.HtmlControls.HtmlAnchor cohortLnk = new HtmlAnchor(); cohortLnk.HRef = String.Format("./cohortDetails.aspx?cohort_id={0}", dr_cohort["cohort_id"]); cohortLnk.Attributes["tabindex"] = "0"; cohortLnk.Attributes["role"] = "button"; cohortLnk.Attributes["data-toggle"] = "popover"; cohortLnk.Attributes["data-trigger"] = "focus"; cohortLnk.Attributes["data-placement"] = "top"; cohortLnk.Attributes["data-trigger"] = "hover"; cohortLnk.Attributes["data-content"] = String.Format("{0}", dr_cohort["cohort_name"]); cohortLnk.InnerHtml = helper.HTMLEncode(e.Row.Cells[_i].Text); hc.CssClass = "table-col-10perc sortable"; hc.Controls.Add(cohortLnk); } else { hc.CssClass = "table-col-20perc"; hc.Text = e.Row.Cells[_i].Text; } e.Row.Cells.RemoveAt(_i); e.Row.Cells.AddAt(_i, hc); } e.Row.TableSection = TableRowSection.TableHeader; } else if (e.Row.RowType == DataControlRowType.DataRow) { /// if the cell is just "Select Cancer Site..." if (e.Row.Cells[0] != null && (e.Row.Cells[0].Text == "Select Cancer Type To Continue" || e.Row.Cells[0].Text.Contains("None of the select cohorts reported any"))) { return; } ///--------------------------------------------------- /// change to tableheadercell the gender /// string orgColumnName = e.Row.Cells[1].Text; //string _curSumLbl = orgColumnName.Split('.')[1]; System.Web.UI.WebControls.TableHeaderCell nmHdr = new TableHeaderCell(); nmHdr.Attributes["headers"] = cancerTbl.Columns[0].ColumnName.Replace(" ", string.Empty); nmHdr.ID = orgColumnName; nmHdr.Text = orgColumnName; //nmHdr.Controls.Add(new LiteralControl(orgColumnName)); //CECWebSrv.GetCohortWebFieldLabelByColumnName(UserToken, orgColumnName) e.Row.Cells.RemoveAt(1); e.Row.Cells.AddAt(1, nmHdr); ///--------------------------------------------------- /// change to tableheadercell the cancer /// string _curCanLbl = e.Row.Cells[0].Text; if (Genders.Length == 2) { if (e.Row.Cells[1].Text == "Males") { System.Web.UI.WebControls.TableHeaderCell cnHdr = new TableHeaderCell(); cnHdr.CssClass = "comRowHeader"; cnHdr.ID = _curCanLbl; cnHdr.RowSpan = 2; cnHdr.Text = select_cancer.cancer_list[e.Row.Cells[0].Text]; ///cnHdr.Controls.Add(new LiteralControl()); //CECWebSrv.GetCancerLabel(UserToken, int.Parse(e.Row.Cells[0].Text) e.Row.Cells.RemoveAt(0); e.Row.Cells.AddAt(0, cnHdr); } else { e.Row.Cells.RemoveAt(0); } } else { System.Web.UI.WebControls.TableHeaderCell cnHdr = new TableHeaderCell(); cnHdr.CssClass = "comRowHeader"; cnHdr.ID = _curCanLbl; cnHdr.Text = select_cancer.cancer_list[e.Row.Cells[0].Text]; //cnHdr.Controls.Add(new LiteralControl()); //CECWebSrv.GetCancerLabel(UserToken, int.Parse(e.Row.Cells[0].Text) e.Row.Cells.RemoveAt(0); e.Row.Cells.AddAt(0, cnHdr); } ///----------------------------------------------------- /// go through the cells starting at a specific index to write /// in attributes for screen readers for (int _i = 1; _i < e.Row.Cells.Count; _i++) { string _cohort = string.Empty; if (e.Row.Cells.Count < cancerTbl.Columns.Count) { _cohort = cancerTbl.Columns[_i + 1].ColumnName; } else { _cohort = cancerTbl.Columns[_i].ColumnName; } e.Row.Cells[_i].Attributes["headers"] = String.Format("{0} {1} {2}", _curCanLbl, orgColumnName, _cohort); /// --------------------------------------- /// was N/P, per Amy 23-April, 0 is preferred /// per Amy, 4-May, 0 should appear if the cohort has incident cancers--even for prevelant; /// show N/P if incident and prevelant is not provided if (String.IsNullOrWhiteSpace(e.Row.Cells[_i].Text) || e.Row.Cells[_i].Text == "-1" || e.Row.Cells[_i].Text == " ") { e.Row.Cells[_i].Text = "N/P"; //if (CECWebSrv.CohortHasCancerIndicator(UserToken, (CancerCategory.ToLower() == "incident" ? "prevalent" : "incident"), _cohort)) //e.Row.Cells[_i].Text = "0"; //else // e.Row.Cells[_i].Text = "N/P"; } } } }
protected void dgnews_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DropDownList ddlgrade = (DropDownList)e.Row.FindControl("ddlgrade"); // DropDownList ddlstatus = (DropDownList)e.Row.FindControl("ddlstatus"); TextBox txtremark = (TextBox)e.Row.FindControl("txtremark"); // TextBox txthours = (TextBox)e.Row.FindControl("txthours"); TextBox txtcomments = (TextBox)e.Row.FindControl("txtcomments"); Literal ltrgrade = (Literal)e.Row.FindControl("ltrgrade"); Literal ltrcomments = (Literal)e.Row.FindControl("ltrcomments"); // Literal ltrhours = (Literal)e.Row.FindControl("ltrhours"); Literal ltrremark = (Literal)e.Row.FindControl("ltrremark"); // Literal ltrstatus = (Literal)e.Row.FindControl("ltrstatus"); LinkButton lbtndel = (LinkButton)e.Row.FindControl("lbtndelete"); // LinkButton lbtnstatus = (LinkButton)e.Row.FindControl("lbtnstatus"); //if (DataBinder.Eval(e.Row.DataItem, "status") != null) // ddlstatus.Text = DataBinder.Eval(e.Row.DataItem, "status").ToString(); if (DataBinder.Eval(e.Row.DataItem, "grade") != null) { ddlgrade.Text = DataBinder.Eval(e.Row.DataItem, "grade").ToString(); } HtmlImage imgassignedby = (HtmlImage)e.Row.FindControl("imgassignedby"); if (DataBinder.Eval(e.Row.DataItem, "assignedbyid").ToString().ToLower() == "self assigned") { imgassignedby.Src = "images/graydot.png"; } else { imgassignedby.Src = "images/greendot.png"; } //Hide DELETE button lbtndel.Visible = false; //Check whether work on task has started or not if (DataBinder.Eval(e.Row.DataItem, "status").ToString().ToLower().Trim() == "not started" || DataBinder.Eval(e.Row.DataItem, "status").ToString() == "") { //If work has started then //Check whether logged in user is a manager or not //If it is a manager then , it can delete the task yet not started if (ViewState["add"] != null && ViewState["add"].ToString() == "1") { lbtndel.Visible = true; } //If logged in user is not a manager - then check whether it is self assigned task? //If it is self assigned task, then user can delete it. so show the delete button else if (DataBinder.Eval(e.Row.DataItem, "createdby").ToString() == Session["userid"].ToString()) { lbtndel.Visible = true; } } if (ViewState["add"] != null && ViewState["add"].ToString() == "1") { ddlgrade.Enabled = false; ddlgrade.ToolTip = "Task Grade can be given after completion of task"; txtcomments.Enabled = true; txtremark.Visible = true; if (DataBinder.Eval(e.Row.DataItem, "empid").ToString() == Session["userid"].ToString()) { if (DataBinder.Eval(e.Row.DataItem, "status").ToString().ToLower().Trim() == "completed") { //txtremark.Visible = false; // txthours.Visible = false; // ddlstatus.Visible = false; //ltrhours.Visible = true; //ltrremark.Visible = true; //ltrstatus.Visible = true; ddlgrade.Enabled = true; } } else { if (DataBinder.Eval(e.Row.DataItem, "status").ToString().ToLower().Trim() == "completed") { ddlgrade.Enabled = true; } //txthours.Visible = false; //txtremark.Visible = false; //ddlstatus.Visible = false; //ltrhours.Visible = true; //ltrremark.Visible = true; //ltrstatus.Visible = true; } } else { // lbtndel.Visible = false; ddlgrade.Visible = false; txtcomments.Visible = false; ltrcomments.Visible = true; ltrgrade.Visible = true; txtremark.Visible = false; ltrremark.Visible = true; if (DataBinder.Eval(e.Row.DataItem, "status").ToString().ToLower().Trim() == "completed") { //txthours.Enabled = false; //txtremark.Enabled = false; //ddlstatus.Enabled = false; } else { if (DataBinder.Eval(e.Row.DataItem, "empid").ToString() == Session["userid"].ToString()) { txtremark.Visible = true; ltrremark.Visible = false; } //txthours.Enabled = false; //txtremark.Enabled = false; //ddlstatus.Enabled = false; } } } }
// скрытие строк protected void gvGirafik_RowDataBound(object sender, GridViewRowEventArgs e) { e.Row.Cells[1].Visible = false; e.Row.Cells[8].Visible = false; }
protected void gdvDetail_RowCreated(object sender, GridViewRowEventArgs e) { }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("WTS_SYSTEM_CONTRACTID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { string selectedId = row.Cells[DCC.IndexOf("CONTRACTID")].Text; string selectedText = row.Cells[DCC.IndexOf("CONTRACT")].Text; DropDownList ddl = null; ddl = WTSUtility.CreateGridDropdownList(_dtContract, "CONTRACT", "CONTRACT", "CONTRACTID", itemId, selectedId, selectedText, null); ddl.Attributes.Add("field", "Contract"); row.Cells[DCC.IndexOf("CONTRACT")].Controls.Add(ddl); bool primary = false; if (row.Cells[DCC.IndexOf("Primary")].HasControls() && row.Cells[DCC.IndexOf("Primary")].Controls[0] is CheckBox) { primary = ((CheckBox)row.Cells[DCC.IndexOf("Primary")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("Primary")].Text == "1") { primary = true; } row.Cells[DCC.IndexOf("Primary")].Controls.Clear(); CheckBox chk = WTSUtility.CreateGridCheckBox("Primary", itemId, primary); chk.Attributes.Add("field", "Primary"); row.Cells[DCC.IndexOf("Primary")].Controls.Add(chk); bool archive = false; if (row.Cells[DCC.IndexOf("Archive")].HasControls() && row.Cells[DCC.IndexOf("Archive")].Controls[0] is CheckBox) { archive = ((CheckBox)row.Cells[DCC.IndexOf("Archive")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("Archive")].Text == "1") { archive = true; } row.Cells[DCC.IndexOf("Archive")].Controls.Clear(); row.Cells[DCC.IndexOf("Archive")].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", itemId, archive)); } if (!CanEdit) { Image imgBlank = new Image(); imgBlank.Height = 10; imgBlank.Width = 10; imgBlank.ImageUrl = "Images/Icons/blank.png"; imgBlank.AlternateText = ""; row.Cells[DCC["X"].Ordinal].Controls.Add(imgBlank); } else { row.Cells[DCC["X"].Ordinal].Controls.Add(WTSUtility.CreateGridDeleteButton(itemId, row.Cells[DCC.IndexOf("CONTRACT")].Text.Trim())); } }
protected void OnRowDataBound(object sender, GridViewRowEventArgs e) { }
protected void OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string job_id = grid.DataKeys[e.Row.RowIndex].Value.ToString(); GridView gvOrders = e.Row.FindControl("grid_nested") as GridView; gvOrders.DataSource = GetData(string.Format("select * from job_trailer_detail where show_=1 and job_id='{0}'", job_id)); gvOrders.DataBind(); } //ImageButton myImageButton = e.Row.FindControl("print_barcode") as ImageButton; //if (myImageButton != null) //{ // if (Convert.ToBoolean(DataBinder.Eval(e.Row.DataItem, "print_barcode"))) // { // myImageButton.ImageUrl = "Images/check.png"; // } // else // { // myImageButton.ImageUrl = "Images/wait.png"; // } //} ImageButton myImageButton1 = e.Row.FindControl("timestamp1") as ImageButton; if (myImageButton1 != null) { if (DataBinder.Eval(e.Row.DataItem, "timestamp1").ToString() != "") { myImageButton1.ImageUrl = "Images/check.png"; myImageButton1.ID = "check"; } else { myImageButton1.ImageUrl = "Images/wait.png"; } } ImageButton myImageButton2 = e.Row.FindControl("timestamp2") as ImageButton; if (myImageButton2 != null) { if (DataBinder.Eval(e.Row.DataItem, "timestamp2").ToString() != "") { myImageButton2.ImageUrl = "Images/check.png"; } else { myImageButton2.ImageUrl = "Images/wait.png"; } } ImageButton myImageButton3 = e.Row.FindControl("timestamp3") as ImageButton; if (myImageButton3 != null) { if (DataBinder.Eval(e.Row.DataItem, "timestamp3").ToString() != "") { myImageButton3.ImageUrl = "Images/check.png"; } else { myImageButton3.ImageUrl = "Images/wait.png"; } } ImageButton myImageButton4 = e.Row.FindControl("timestamp4") as ImageButton; if (myImageButton4 != null) { if (DataBinder.Eval(e.Row.DataItem, "timestamp4").ToString() != "") { myImageButton4.ImageUrl = "Images/check.png"; } else { myImageButton4.ImageUrl = "Images/wait.png"; } } ImageButton myImageButtonSound = e.Row.FindControl("SOUND") as ImageButton; if (myImageButton1 != null) { if (DataBinder.Eval(e.Row.DataItem, "timestamp1").ToString() != "" && DataBinder.Eval(e.Row.DataItem, "timestamp2").ToString() == "") { myImageButtonSound.ImageUrl = "Images/sound.png"; ScriptManager.RegisterClientScriptBlock(this, GetType(), "uKey", "PlaySound_Warning();", true); e.Row.BackColor = Color.Red; e.Row.ForeColor = Color.Yellow; } else { myImageButtonSound.ImageUrl = "Images/wait.png"; } } }
protected void GridView2_RowCreated(object sender, GridViewRowEventArgs e) { }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType.Equals(DataControlRowType.Header)) { for (int iCol = 0; iCol < e.Row.Cells.Count; iCol++) { e.Row.Cells[iCol].Attributes.Add("class", "table_h"); e.Row.Cells[iCol].Wrap = false; } } else if (e.Row.RowType.Equals(DataControlRowType.DataRow) || e.Row.RowState.Equals(DataControlRowState.Alternate)) { #region Set datagrid row color string strEvenColor, strOddColor, strMouseOverColor; strEvenColor = ((DataSet)Application["xmlconfig"]).Tables["colorDataGridRow"].Rows[0]["Even"].ToString(); strOddColor = ((DataSet)Application["xmlconfig"]).Tables["colorDataGridRow"].Rows[0]["Odd"].ToString(); strMouseOverColor = ((DataSet)Application["xmlconfig"]).Tables["colorDataGridRow"].Rows[0]["MouseOver"].ToString(); e.Row.Style.Add("valign", "top"); e.Row.Style.Add("cursor", "hand"); e.Row.Attributes.Add("onMouseOver", "this.style.backgroundColor='" + strMouseOverColor + "'"); if (e.Row.RowState.Equals(DataControlRowState.Alternate)) { e.Row.Attributes.Add("bgcolor", strOddColor); e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor='" + strOddColor + "'"); } else { e.Row.Attributes.Add("bgcolor", strEvenColor); e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor='" + strEvenColor + "'"); } #endregion Label lblNo = (Label)e.Row.FindControl("lblNo"); int nNo = (GridView1.PageSize * GridView1.PageIndex) + e.Row.RowIndex + 1; lblNo.Text = nNo.ToString(); Label lblbudget_plan_code = (Label)e.Row.FindControl("lblbudget_plan_code"); Label lblbudget_plan_name = (Label)e.Row.FindControl("lblbudget_plan_name"); Label lblc_active = (Label)e.Row.FindControl("lblc_active"); string strStatus = lblc_active.Text; #region set ImageStatus ImageButton imgStatus = (ImageButton)e.Row.FindControl("imgStatus"); if (strStatus.Equals("Y")) { imgStatus.ImageUrl = ((DataSet)Application["xmlconfig"]).Tables["imgStatus"].Rows[0]["img"].ToString(); imgStatus.Attributes.Add("title", ((DataSet)Application["xmlconfig"]).Tables["imgStatus"].Rows[0]["title"].ToString()); imgStatus.Attributes.Add("onclick", "return false;"); } else { imgStatus.ImageUrl = ((DataSet)Application["xmlconfig"]).Tables["imgStatus"].Rows[0]["imgdisable"].ToString(); imgStatus.Attributes.Add("title", ((DataSet)Application["xmlconfig"]).Tables["imgStatus"].Rows[0]["titledisable"].ToString()); imgStatus.Attributes.Add("onclick", "return false;"); } #endregion #region set ImageView ImageButton imgView = (ImageButton)e.Row.FindControl("imgView"); imgView.Attributes.Add("onclick", "OpenPopUp('950px','350px','94%','แสดงข้อมูลผังงบประมาณ','budget_plan_view.aspx?mode=view&budget_plan_code=" + lblbudget_plan_code.Text + "','1');return false;"); imgView.ImageUrl = ((DataSet)Application["xmlconfig"]).Tables["imgView"].Rows[0]["img"].ToString(); imgView.Attributes.Add("title", ((DataSet)Application["xmlconfig"]).Tables["imgView"].Rows[0]["title"].ToString()); #endregion #region set Image Edit & Delete ImageButton imgEdit = (ImageButton)e.Row.FindControl("imgEdit"); Label lblCanEdit = (Label)e.Row.FindControl("lblCanEdit"); imgEdit.Attributes.Add("onclick", "OpenPopUp('900px','350px','90%','แก้ไข" + base.PageDes + "','budget_plan_control.aspx?budget_type=" + this.BudgetType + "&mode=edit&budget_plan_code=" + lblbudget_plan_code.Text + "&page=" + GridView1.PageIndex.ToString() + "&canEdit=Y','1');return false;"); imgEdit.ImageUrl = ((DataSet)Application["xmlconfig"]).Tables["imgEdit"].Rows[0]["img"].ToString(); imgEdit.Attributes.Add("title", ((DataSet)Application["xmlconfig"]).Tables["imgEdit"].Rows[0]["title"].ToString()); ImageButton imgDelete = (ImageButton)e.Row.FindControl("imgDelete"); imgDelete.ImageUrl = ((DataSet)Application["xmlconfig"]).Tables["imgDelete"].Rows[0]["img"].ToString(); imgDelete.Attributes.Add("title", ((DataSet)Application["xmlconfig"]).Tables["imgDelete"].Rows[0]["title"].ToString()); imgDelete.Attributes.Add("onclick", "return confirm(\"คุณต้องการลบผังงบประมาณ : " + lblbudget_plan_code.Text + " ?\");"); #endregion } }
protected void mymaster_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label _sys_id = (Label)e.Row.FindControl("lbSys_Id"); DataTable _dtdetails = new DataTable(); _dtdetails.Columns.Add("e_b_ref", typeof(string)); _dtdetails.Columns.Add("B_Z", typeof(string)); _dtdetails.Columns.Add("Cat", typeof(string)); _dtdetails.Columns.Add("F_lvl", typeof(string)); _dtdetails.Columns.Add("Seq_No", typeof(string)); _dtdetails.Columns.Add("Loc", typeof(string)); _dtdetails.Columns.Add("F_from", typeof(string)); _dtdetails.Columns.Add("C_id", typeof(int)); _dtdetails.Columns.Add("Sys_name", typeof(string)); _dtdetails.Columns.Add("Sys_id", typeof(int)); _dtdetails.Columns.Add("test1", typeof(string)); _dtdetails.Columns.Add("test2", typeof(string)); _dtdetails.Columns.Add("test3", typeof(string)); _dtdetails.Columns.Add("test4", typeof(string)); _dtdetails.Columns.Add("test5", typeof(string)); _dtdetails.Columns.Add("test6", typeof(string)); _dtdetails.Columns.Add("test7", typeof(string)); _dtdetails.Columns.Add("Per_com1", typeof(string)); _dtdetails.Columns.Add("Accept1", typeof(string)); _dtdetails.Columns.Add("filed1", typeof(string)); _dtdetails.Columns.Add("Comm", typeof(string)); _dtdetails.Columns.Add("Act_by", typeof(string)); _dtdetails.Columns.Add("Act_date", typeof(string)); _dtdetails.Columns.Add("test11", typeof(string)); var _details = from _data in _dtresult.AsEnumerable() where _data.Field <int>("Sys_Id") == Convert.ToInt32(_sys_id.Text) select _data; foreach (var row in _details) { DataRow _row = _dtdetails.NewRow(); _row[0] = row["e_b_ref"].ToString(); _row[1] = row["B_Z"].ToString(); _row[2] = row["Cat"].ToString(); _row[3] = row["F_lvl"].ToString(); _row[4] = SeqNo(row["Seq_No"].ToString()); _row[5] = row["Loc"].ToString(); _row[6] = row["F_from"].ToString(); _row[7] = row["C_id"].ToString(); _row[8] = row["Sys_name"].ToString(); _row[9] = row["Sys_id"].ToString(); _row[10] = row["test1"].ToString(); _row[11] = row["test2"].ToString(); _row[12] = row["test3"].ToString(); _row[13] = row["test4"].ToString(); _row[14] = row["test5"].ToString(); _row[15] = row["test6"].ToString(); _row[16] = row["test7"].ToString(); _row[17] = row["Per_com1"].ToString(); _row[18] = row["accept1"].ToString(); _row[19] = row["filed1"].ToString(); _row[20] = row["Comm"].ToString(); _row[21] = row["Act_by"].ToString(); _row[22] = row["Act_date"].ToString(); _row[23] = row["test11"].ToString(); _dtdetails.Rows.Add(_row); } GridView _mydetails = (GridView)e.Row.FindControl("mydetails"); _mydetails.DataSource = _dtdetails; _mydetails.DataBind(); //Generate_Summary(); //if (_exp == false) //{ // _mydetails.Visible = false; // _btn.Text = "+"; //} //else //{ // _mydetails.Visible = true; // _btn.Text = "-"; //} } }
protected void CustomizeEnabledColumn(GridViewRowEventArgs e) { CustomizeBooleanColumn(e.Row, "EnabledImage", "Enabled"); }
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType.Equals(DataControlRowType.Header)) { #region Create Item Header bool bSort = false; int i = 0; for (i = 0; i < GridView1.Columns.Count; i++) { if (ViewState["sort"].Equals(GridView1.Columns[i].SortExpression)) { bSort = true; break; } } if (bSort) { foreach (System.Web.UI.Control c in e.Row.Controls[i].Controls) { if (c.GetType().ToString().Equals("System.Web.UI.WebControls.DataControlLinkButton")) { if (ViewState["direction"].Equals("ASC")) { ((LinkButton)c).Text += "<img border=0 src='" + ((DataSet)Application["xmlconfig"]).Tables["imgAsc"].Rows[0]["img"].ToString() + "'>"; } else { ((LinkButton)c).Text += "<img border=0 src='" + ((DataSet)Application["xmlconfig"]).Tables["imgDesc"].Rows[0]["img"].ToString() + "'>"; } } } } #endregion } else if (e.Row.RowType.Equals(DataControlRowType.Pager)) { TableCell tbc = e.Row.Cells[0]; Label lblPrev = null; Label lblNext = null; ImageButton lbtnPrev = null; ImageButton lbtnNext = null; #region find and store Previous and Next Page TableRow tbr = (TableRow)tbc.Controls[0].Controls[0]; foreach (System.Web.UI.Control c in tbr.Controls) { if (c.GetType().ToString().Equals("System.Web.UI.WebControls.Label")) { Label lbl = (Label)c; if (lbl.Text.IndexOf("P") != -1) { lblPrev = lbl; lblPrev.Text = string.Empty; } if (lbl.Text.IndexOf("N") != -1) { lblNext = lbl; lblNext.Text = string.Empty; } } if (c.Controls[0].GetType().ToString().Equals("System.Web.UI.WebControls.DataControlImageButton")) { ImageButton lbtn = (ImageButton)c.Controls[0]; if (lbtn.AlternateText.IndexOf("P") != -1) { lbtnPrev = lbtn; lbtnPrev.ImageUrl = "~/images/prev.gif"; } if (lbtn.AlternateText.IndexOf("N") != -1) { lbtnNext = lbtn; lbtnNext.ImageUrl = "~/images/next.gif"; } } } #endregion #region render new pager tbc.Text = string.Empty; Literal lblPager = new Literal(); lblPager.Text = "<TABLE border='0' width='100%' cellpadding='0' cellspacing='0'><TR><TD width='30%' valign='middle'>"; tbc.Controls.Add(lblPager); Label lblTotalRecord = new Label(); lblTotalRecord.Attributes.Add("class", "label_h"); lblTotalRecord.Text = "พบข้อมูล " + txthTotalRecord.Value.ToString() + " รายการ."; tbc.Controls.Add(lblTotalRecord); lblPager = new Literal(); lblPager.Text = "</TD><TD width='30%' align='center' valign='middle'>"; tbc.Controls.Add(lblPager); DropDownList cboPerPage = new DropDownList(); cboPerPage.ID = "cboPerPage"; DataTable entries; if ((DataSet)Application["xmlconfig"] == null) { return; } else { entries = ((DataSet)Application["xmlconfig"]).Tables["RecordPerPage"]; } for (int i = 0; i < entries.Rows.Count; i++) { cboPerPage.Items.Add(new ListItem(entries.Rows[i][0].ToString(), entries.Rows[i][1].ToString())); } if (cboPerPage.Items.FindByValue(strRecordPerPage) != null) { cboPerPage.Items.FindByValue(strRecordPerPage).Selected = true; } cboPerPage.AutoPostBack = true; cboPerPage.SelectedIndexChanged += new System.EventHandler(cboPerPage_SelectedIndexChanged); tbc.Controls.Add(cboPerPage); lblPager = new Literal(); lblPager.Text = " <span class=\"label_h\">รายการ/หน้า</span></TD><TD width='40%' align='right' valign='middle'>"; tbc.Controls.Add(lblPager); if (lblPrev != null) { tbc.Controls.Add(lblPrev); } else if (lbtnPrev != null) { tbc.Controls.Add(lbtnPrev); } lblPager = new Literal(); lblPager.Text = " <span class=\"label_h\">หน้าที่: </span>"; tbc.Controls.Add(lblPager); TextBox txtPage = new TextBox(); txtPage.AutoPostBack = false; txtPage.ID = "txtPage"; txtPage.Width = System.Web.UI.WebControls.Unit.Parse("30px"); txtPage.Attributes.Add("class", "text1"); txtPage.Style.Add("text-align", "right"); int nCurrentPage = (GridView1.PageIndex + 1); txtPage.Text = nCurrentPage.ToString();//strPageNo; txtPage.Attributes.Add("onkeypress", "javascript: return checkKeyCode(event);"); txtPage.Attributes.Add("onkeyup", "javasctipt: checkInt(this, " + GridView1.PageCount.ToString() + ");"); tbc.Controls.Add(txtPage); lblPager = new Literal(); lblPager.Text = "<span class=\"label_h\"> จากทั้งหมด " + GridView1.PageCount.ToString() + " </span>"; tbc.Controls.Add(lblPager); lblPager = new Literal(); lblPager.Text = " "; tbc.Controls.Add(lblPager); ImageButton imgGo = new ImageButton(); imgGo.ID = "imgGo"; imgGo.ImageUrl = ((DataSet)Application["xmlconfig"]).Tables["imgGo"].Rows[0]["img"].ToString(); imgGo.Attributes.Add("title", ((DataSet)Application["xmlconfig"]).Tables["imgGo"].Rows[0]["title"].ToString()); imgGo.Attributes.Add("onclick", "javascript: return checkPage(" + GridView1.PageCount.ToString() + ",'กรุณาระบุข้อมูลให้ถูกต้อง.|||ctl00$ASPxRoundPanel1$ContentPlaceHolder2$GridView1$ctl01$txtPage');"); imgGo.Click += new System.Web.UI.ImageClickEventHandler(this.imgGo_Click); tbc.Controls.Add(imgGo); lblPager = new Literal(); lblPager.Text = " "; tbc.Controls.Add(lblPager); if (lblNext != null) { tbc.Controls.Add(lblNext); } else if (lbtnNext != null) { tbc.Controls.Add(lbtnNext); } lblPager = new Literal(); lblPager.Text = "</TD></TR></TABLE>"; tbc.Controls.Add(lblPager); #endregion } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { string strTaskID = string.Empty; if (e.Row.RowType == DataControlRowType.DataRow) { //string strSql_file_name; //string snn1; //GridViewRow row = GridView2.Rows[e.RowIndex]; //DataSet ds = new DataSet(); // strSql_file_name = " select distinct (t3.file_name) " + //" from ( " + //" select * " + //" from night_inspection_file t " + //" where t.sn = '" + ((DataRowView)e.Row.DataItem)["sn"] + "' " + //" order by t.dttm desc) t3 "; // ds = func.get_dataSet_access(strSql_file_name, conn); // ((DataList)e.Row.FindControl("DataList1")).DataSource = ds.Tables[0]; // ((DataList)e.Row.FindControl("DataList1")).DataBind(); // String Flag_satus = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "open_close_flag")); // if (Flag_satus == "Open") // //e.Row.Cells[0].BackColor = Color.Yellow; // e.Row.Cells[6].Style.Add("background-color", "#FFFF80"); // if (Flag_satus == "Closed") // e.Row.Cells[6].Style.Add("background-color", "#95CAFF"); // if (Flag_satus == "Cancel") // e.Row.Cells[6].Style.Add("background-color", "#FF9DFF"); //strTaskID = ((DataRowView)e.Row.DataItem)["task_id"].ToString(); // dv.RowFilter = "task_id=" + strTaskID; //dv.Sort = "is_owner desc"; //task member datalist //((DataList)e.Row.FindControl("dlTaskMember")).DataSource = dv; //((DataList)e.Row.FindControl("dlTaskMember")).DataBind(); //image link to task content //string sMessage = String.Format("return(OpenTask('{0}'));", strTaskID); //((ImageButton)e.Row.FindControl("btnEdit")).OnClientClick = sMessage;//"if (OpenTask('" + sMessage + "')==false) {return false;}"; } }
protected void gMain_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ImageButton ib = (ImageButton)e.Row.FindControl("imgDelete"); ib.Attributes.Add("onClick", "javascript: return confirm('" + AppLogic.GetString("admin.common.ConfirmDeletion", SkinID, LocaleSetting) + "')"); //Click to edit if ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == DataControlRowState.Alternate)) { e.Row.Attributes.Add("ondblclick", "javascript:__doPostBack('gMain','Edit$" + e.Row.RowIndex + "')"); } } if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit) { DataRowView myrow = (DataRowView)e.Row.DataItem; DropDownList ddXmlPackage = (DropDownList)e.Row.FindControl("ddEditXMLPackage"); ddXmlPackage.Items.Clear(); ListItem myNode = new ListItem(); myNode.Value = AppLogic.GetString("admin.eventhandler.SelectPackage", SkinID, LocaleSetting); ddXmlPackage.Items.Add(myNode); String Location = CommonLogic.SafeMapPath("~/XMLPackages"); System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(Location); foreach (System.IO.FileInfo f in dir.GetFiles("event.*")) { //LOAD FILES ListItem myNode1 = new ListItem(); myNode1.Value = f.Name.ToUpperInvariant(); ddXmlPackage.Items.Add(myNode1); } if (ddXmlPackage.Items.Count > 1) { ddXmlPackage.SelectedValue = myrow["XMLPackage"].ToString().ToUpperInvariant(); } try { if (ViewState["FirstTimeEdit"].ToString() == "0") { TextBox txt = (TextBox)e.Row.FindControl("txtEventName"); txt.Visible = false; Literal lt = (Literal)e.Row.FindControl("ltEventName"); lt.Visible = true; } else { TextBox txt = (TextBox)e.Row.FindControl("txtEventName"); txt.Visible = true; Literal lt = (Literal)e.Row.FindControl("ltEventName"); lt.Visible = false; } } catch { TextBox txt = (TextBox)e.Row.FindControl("txtEventName"); txt.Visible = false; Literal lt = (Literal)e.Row.FindControl("ltEventName"); lt.Visible = true; } } }
protected void GrdRegistration_RowDataBound(object sender, GridViewRowEventArgs e) { Staff staff = StaffDB.GetByID(GetFormID()); if (staff == null) { HideTableAndSetErrorMessage("", "Invalid URL Parameters"); return; } DataTable dt = Session["registerorgtostaff_data"] as DataTable; bool tblEmpty = (dt.Rows.Count == 1 && dt.Rows[0][0] == DBNull.Value); if (!tblEmpty && e.Row.RowType == DataControlRowType.DataRow) { Label lblId = (Label)e.Row.FindControl("lblId"); DataRow[] foundRows = dt.Select("register_staff_id=" + lblId.Text); DataRow thisRow = foundRows[0]; DropDownList ddlOrganisation = (DropDownList)e.Row.FindControl("ddlOrganisation"); if (ddlOrganisation != null) { Organisation[] incList_orig = RegisterStaffDB.GetOrganisationsOf(staff.StaffID); Organisation[] incList = Organisation.RemoveByID(incList_orig, Convert.ToInt32(thisRow["organisation_id"])); DataTable orgs = OrganisationDB.GetDataTable_AllNotInc(incList, true, false, false, true, true); orgs.DefaultView.Sort = "name ASC"; foreach (DataRowView row in orgs.DefaultView) { ddlOrganisation.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString())); } ddlOrganisation.SelectedValue = thisRow["organisation_id"].ToString(); } ImageButton btnDelete = (ImageButton)e.Row.FindControl("btnDelete"); if (btnDelete != null) { bool is_deleted = Convert.ToBoolean(thisRow["registration_is_deleted"]); if (is_deleted) { btnDelete.CommandName = "_UnDelete"; btnDelete.ImageUrl = "~/images/tick-24.png"; btnDelete.AlternateText = "UnDelete"; btnDelete.ToolTip = "UnDelete"; btnDelete.Visible = false; } } Utilities.AddConfirmationBox(e); if ((e.Row.RowState & DataControlRowState.Edit) > 0) { Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow); } } if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlOrganisation = (DropDownList)e.Row.FindControl("ddlNewOrganisation"); if (ddlOrganisation != null) { Organisation[] incList = RegisterStaffDB.GetOrganisationsOf(staff.StaffID); DataTable orgs = OrganisationDB.GetDataTable_AllNotInc(incList, true, false, false, true, true); orgs.DefaultView.Sort = "name ASC"; foreach (DataRowView row in orgs.DefaultView) { ddlOrganisation.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString())); } if (orgs.Rows.Count == 0) { hideFotter = true; } } if (staff.IsExternal) { CheckBox chkNewIncMondays = (CheckBox)e.Row.FindControl("chkNewIncMondays"); CheckBox chkNewIncTuesdays = (CheckBox)e.Row.FindControl("chkNewIncTuesdays"); CheckBox chkNewIncWednesdays = (CheckBox)e.Row.FindControl("chkNewIncWednesdays"); CheckBox chkNewIncThursdays = (CheckBox)e.Row.FindControl("chkNewIncThursdays"); CheckBox chkNewIncFridays = (CheckBox)e.Row.FindControl("chkNewIncFridays"); CheckBox chkNewIncSaturdays = (CheckBox)e.Row.FindControl("chkNewIncSaturdays"); CheckBox chkNewIncSundays = (CheckBox)e.Row.FindControl("chkNewIncSundays"); if (chkNewIncMondays != null) { chkNewIncMondays.Checked = false; } if (chkNewIncTuesdays != null) { chkNewIncTuesdays.Checked = false; } if (chkNewIncWednesdays != null) { chkNewIncWednesdays.Checked = false; } if (chkNewIncThursdays != null) { chkNewIncThursdays.Checked = false; } if (chkNewIncFridays != null) { chkNewIncFridays.Checked = false; } if (chkNewIncSaturdays != null) { chkNewIncSaturdays.Checked = false; } if (chkNewIncSundays != null) { chkNewIncSundays.Checked = false; } } } }
protected void GvAcs_OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.ToolTip = (e.Row.DataItem as DataRowView)["po_no"].ToString(); } if (e.Row.RowType == DataControlRowType.Header) { Label lblHeader = (Label)e.Row.FindControl("lblHeader"); Label lblHeader2 = (Label)e.Row.FindControl("lblHeader2"); Label lblHeader60 = (Label)e.Row.FindControl("lblHeader60"); Label lblHeader61 = (Label)e.Row.FindControl("lblHeader61"); Label lblacsbook = (Label)e.Row.FindControl("lblacsbook"); string strSelectCmd = "select * from View_Tna_Plan WHERE TnaByrNm = '" + ddlbuyerAcs.SelectedItem.Value + "' "; SqlDataAdapter da = new SqlDataAdapter(strSelectCmd, conn); DataSet ds = new DataSet(); da.Fill(ds); lblacsbook.Text = ds.Tables[0].Rows[0]["Tmplt_Evnt3"].ToString(); lblHeader.Text = ds.Tables[0].Rows[0]["Tmplt_Evnt29"].ToString(); lblHeader2.Text = ds.Tables[0].Rows[0]["Tmplt_Evnt30"].ToString(); lblHeader60.Text = ds.Tables[0].Rows[0]["Tmplt_Evnt60"].ToString(); lblHeader61.Text = ds.Tables[0].Rows[0]["Tmplt_Evnt61"].ToString(); } //if (e.Row.RowType == DataControlRowType.DataRow) //{ if (e.Row.RowType == DataControlRowType.DataRow) { Label lblracsbok = (Label)e.Row.FindControl("lblracsbok"); Label lblr1 = (Label)e.Row.FindControl("lblr1"); Label lblr2 = (Label)e.Row.FindControl("lblr2"); Label lblr60 = (Label)e.Row.FindControl("lblr60"); Label lblr61 = (Label)e.Row.FindControl("lblr61"); Label lbld1 = (Label)e.Row.FindControl("lbld1"); Label lbld2 = (Label)e.Row.FindControl("lbld2"); Label lbld60 = (Label)e.Row.FindControl("lbld60"); Label lbld61 = (Label)e.Row.FindControl("lbld61"); Label lbl1 = (Label)e.Row.FindControl("lbl1"); Label lbl2 = (Label)e.Row.FindControl("lbl2"); Label lbl60 = (Label)e.Row.FindControl("lbl60"); Label lbl61 = (Label)e.Row.FindControl("lbl61"); Button btnActualpln = (Button)e.Row.FindControl("btnActualpln"); Button btnActualpln2 = (Button)e.Row.FindControl("btnActualpln2"); Button btnActualpln60 = (Button)e.Row.FindControl("btnActualpln60"); Button btnActualpln61 = (Button)e.Row.FindControl("btnActualpln61"); if (string.IsNullOrEmpty(lblracsbok.Text.Trim())) { lblracsbok.Text = "Not Received"; lblracsbok.ForeColor = System.Drawing.Color.Red; } //acc pi if (string.IsNullOrEmpty(btnActualpln60.Text.Trim())) { btnActualpln60.Text = "Complete"; btnActualpln60.Enabled = true; //Delay Days Count DateTime d1 = DateTime.Now; DateTime d2 = Convert.ToDateTime(lbl60.Text); int days = (d1 - d2).Days; lbld60.Text = days.ToString(); //Delay Days Count } else { //Delay Days Count DateTime d1 = DateTime.Parse(btnActualpln60.Text); DateTime d2 = Convert.ToDateTime(lbl60.Text); int days = (d1 - d2).Days; lbld60.Text = days.ToString(); //Delay Days Count } //acc pi //Acc bblc open if (string.IsNullOrEmpty(btnActualpln61.Text.Trim())) { btnActualpln61.Text = "Complete"; btnActualpln61.Enabled = true; //Delay Days Count DateTime d1 = DateTime.Now; DateTime d2 = Convert.ToDateTime(lbl61.Text); int days = (d1 - d2).Days; lbld61.Text = days.ToString(); //Delay Days Count } else { //Delay Days Count DateTime d1 = DateTime.Parse(btnActualpln61.Text); DateTime d2 = Convert.ToDateTime(lbl61.Text); int days = (d1 - d2).Days; lbld61.Text = days.ToString(); //Delay Days Count } //Acc bblc open if (string.IsNullOrEmpty(btnActualpln.Text.Trim())) { btnActualpln.Text = "Complete"; btnActualpln.Enabled = true; //Delay Days Count DateTime d1 = DateTime.Now; DateTime d2 = Convert.ToDateTime(lbl1.Text); int days = (d1 - d2).Days; lbld1.Text = days.ToString(); //Delay Days Count } else { //Delay Days Count DateTime d1 = DateTime.Parse(btnActualpln.Text); DateTime d2 = Convert.ToDateTime(lbl1.Text); int days = (d1 - d2).Days; lbld1.Text = days.ToString(); //Delay Days Count } if (string.IsNullOrEmpty(btnActualpln2.Text.Trim())) { btnActualpln2.Text = "Complete"; btnActualpln2.Enabled = true; //Delay Days Count DateTime d1 = DateTime.Now; DateTime d2 = Convert.ToDateTime(lbl2.Text); int days = (d1 - d2).Days; lbld2.Text = days.ToString(); //Delay Days Count } else { //Delay Days Count DateTime d1 = DateTime.Parse(btnActualpln2.Text); DateTime d2 = Convert.ToDateTime(lbl2.Text); int days = (d1 - d2).Days; lbld2.Text = days.ToString(); //Delay Days Count } // gridview cell hover// e.Row.Attributes["onmouseover"] = "this.style.backgroundColor='aquamarine';"; e.Row.Attributes["onmouseout"] = "this.style.backgroundColor='white';"; //acc pi rcv if (!string.IsNullOrEmpty(lbl60.Text)) { DateTime dt = DateTime.Parse(lbl60.Text); if (btnActualpln60.Text.ToString() != "Complete") { lbl60.BackColor = System.Drawing.Color.Empty; lbl60.ForeColor = System.Drawing.Color.Black; } else { if (dt.AddDays(-6) <= DateTime.Now) { lbl60.BackColor = System.Drawing.Color.Yellow; lbl60.ForeColor = System.Drawing.Color.Black; } if (dt <= DateTime.Now) { lbl60.BackColor = System.Drawing.Color.Red; lbl60.ForeColor = System.Drawing.Color.WhiteSmoke; } } } //acc pi rcv //acc bblc open if (!string.IsNullOrEmpty(lbl61.Text)) { DateTime dt = DateTime.Parse(lbl61.Text); if (btnActualpln61.Text.ToString() != "Complete") { lbl61.BackColor = System.Drawing.Color.Empty; lbl61.ForeColor = System.Drawing.Color.Black; } else { if (dt.AddDays(-6) <= DateTime.Now) { lbl61.BackColor = System.Drawing.Color.Yellow; lbl61.ForeColor = System.Drawing.Color.Black; } if (dt <= DateTime.Now) { lbl61.BackColor = System.Drawing.Color.Red; lbl61.ForeColor = System.Drawing.Color.WhiteSmoke; } } } //acc bblc open if (!string.IsNullOrEmpty(lbl1.Text)) { DateTime dt = DateTime.Parse(lbl1.Text); if (btnActualpln.Text.ToString() != "Complete") { lbl1.BackColor = System.Drawing.Color.Empty; lbl1.ForeColor = System.Drawing.Color.Black; } else { if (dt.AddDays(-6) <= DateTime.Now) { lbl1.BackColor = System.Drawing.Color.Yellow; lbl1.ForeColor = System.Drawing.Color.Black; } if (dt <= DateTime.Now) { lbl1.BackColor = System.Drawing.Color.Red; lbl1.ForeColor = System.Drawing.Color.WhiteSmoke; } } } if (!string.IsNullOrEmpty(lbl2.Text)) { DateTime dt = DateTime.Parse(lbl2.Text); if (btnActualpln2.Text.ToString() != "Complete") { lbl2.BackColor = System.Drawing.Color.Empty; lbl2.ForeColor = System.Drawing.Color.Black; } else { if (dt.AddDays(-6) <= DateTime.Now) { lbl2.BackColor = System.Drawing.Color.Yellow; lbl2.ForeColor = System.Drawing.Color.Black; } if (dt <= DateTime.Now) { lbl2.BackColor = System.Drawing.Color.Red; lbl2.ForeColor = System.Drawing.Color.WhiteSmoke; } } } } }
protected void grdcategory_RowCreated(object sender, GridViewRowEventArgs e) { }
protected void GrdViewLedger_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { string DRORCR = ((HiddenField)e.Row.FindControl("DRORCR")).Value; double Debit = 0; // double.Parse(e.Row.Cells[5].Text); double Credit = 0; // double.Parse(e.Row.Cells[4].Text); double OpenBalance = double.Parse(((HiddenField)e.Row.FindControl("OpenBalance")).Value); if (DRORCR == "CR") { Credit = Credit + OpenBalance; } else if (DRORCR == "DR") { Debit = Debit + OpenBalance; } if (Debit > Credit) { ((Label)e.Row.FindControl("lblBalance")).Text = (Debit - Credit).ToString() + " Dr"; } else if (Credit > Debit) { ((Label)e.Row.FindControl("lblBalance")).Text = (Credit - Debit).ToString() + " Cr"; } else { ((Label)e.Row.FindControl("lblBalance")).Text = "0"; } if ((e.Row.Cells[0].Text == "Purchase A/c") || (e.Row.Cells[0].Text == "Cash A/c") || (e.Row.Cells[0].Text == "Sales A/c") || (e.Row.Cells[0].Text == "General Expenses") || (e.Row.Cells[0].Text == "CreditDebitNoteId")) { ((ImageButton)e.Row.FindControl("btnEdit")).Visible = false; ((ImageButton)e.Row.FindControl("lnkB")).Visible = false; ((ImageButton)e.Row.FindControl("btnEditDisabled")).Visible = true; ((ImageButton)e.Row.FindControl("lnkBDisabled")).Visible = true; } BusinessLogic bl = new BusinessLogic(GetConnectionString()); if (bl.CheckIfLedgerUsed(int.Parse(((HiddenField)e.Row.FindControl("ldgID")).Value))) { ((ImageButton)e.Row.FindControl("lnkB")).Visible = false; ((ImageButton)e.Row.FindControl("lnkBDisabled")).Visible = true; } string connection = Request.Cookies["Company"].Value; string usernam = Request.Cookies["LoggedUserName"].Value; if (bl.CheckUserHaveEdit(usernam, "BANKINFO")) { ((ImageButton)e.Row.FindControl("btnEdit")).Visible = false; ((ImageButton)e.Row.FindControl("btnEditDisabled")).Visible = true; } if (bl.CheckUserHaveDelete(usernam, "BANKINFO")) { ((ImageButton)e.Row.FindControl("lnkB")).Visible = false; ((ImageButton)e.Row.FindControl("lnkBDisabled")).Visible = true; } } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
/* * Pre: * Post: The color of the header row is set */ protected void gvStudentSearch_RowDataBound(object sender, GridViewRowEventArgs e) { setHeaderRowColor(gvStudentSearch, e); }
protected void DSVISDAT_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView dr = e.Row.DataItem as DataRowView; string CONTROLTYPE = dr["CONTROLTYPE"].ToString(); string VARIABLENAME = dr["VARIABLENAME"].ToString(); string FIELDNAME = dr["FIELDNAME"].ToString(); string CLASS = dr["CLASS"].ToString(); string MAXLEN = dr["MAXLEN"].ToString(); string DEFULTVAL = dr["DEFULTVAL"].ToString(); string BOLDYN = dr["BOLDYN"].ToString(); string UNLNYN = dr["UNLNYN"].ToString(); string READYN = dr["READYN"].ToString(); string MULTILINEYN = dr["MULTILINEYN"].ToString(); if (BOLDYN == "True") { Label lblField = (Label)e.Row.FindControl("lblFieldName"); lblField.Attributes.Add("class", "fontbold"); } if (UNLNYN == "True") { Label lblField = (Label)e.Row.FindControl("lblFieldName"); lblField.Font.Underline = true; } if (CONTROLTYPE == "TEXTBOX") { TextBox btnEdit = (TextBox)e.Row.FindControl("TXT_FIELD"); btnEdit.Visible = true; btnEdit.ID = VARIABLENAME; btnEdit.CssClass = CLASS; btnEdit.ToolTip = FIELDNAME; if (MAXLEN != "") { btnEdit.MaxLength = Convert.ToInt32(MAXLEN); } if (READYN == "True") { btnEdit.ReadOnly = true; } if (DEFULTVAL != "") { btnEdit.Text = DEFULTVAL; } if (CLASS == "txtTime") { btnEdit.Attributes.Add("onchange", "ValidTime(this)"); } if (MULTILINEYN == "True") { btnEdit.TextMode = TextBoxMode.MultiLine; } } if (CONTROLTYPE == "DROPDOWN") { DropDownList btnEdit = (DropDownList)e.Row.FindControl("DRP_FIELD"); btnEdit.Visible = true; btnEdit.ID = VARIABLENAME; btnEdit.CssClass = CLASS; btnEdit.ToolTip = FIELDNAME; DAL dal; dal = new DAL(); DataSet ds; ds = new DataSet(); ds = dal.GetDropDownData(Action: "1", VariableName: VARIABLENAME); btnEdit.DataSource = ds; btnEdit.DataTextField = "TEXT"; btnEdit.DataValueField = "VALUE"; btnEdit.DataBind(); } if (CONTROLTYPE == "CHECKBOX") { CheckBox btnEdit = (CheckBox)e.Row.FindControl("CHK_FIELD"); btnEdit.Visible = true; btnEdit.ID = VARIABLENAME; btnEdit.CssClass = CLASS; btnEdit.ToolTip = FIELDNAME; } } } catch (Exception ex) { lblErrorMsg.Text = ex.Message.ToString(); throw; } }
protected void StockDisplayGrid_RowDataBound(object sender, GridViewRowEventArgs e) { }
/// <summary> /// 效果列表行绑定 /// </summary> protected void gvEffectList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DirectoryInfo EffectDir = e.Row.DataItem as DirectoryInfo; if (!EffectDir.Exists) { EffectDir.Create(); } //获取效果数据的XML String EffectDBPath = String.Format("{0}\\EffectDB.xml", EffectDir.FullName); if (File.Exists(EffectDBPath)) { XmlFormat xf = new XmlFormat(EffectDBPath); EffectDB ResultDB = xf.ToItem <EffectDB>(); //构造图片的路径 Image imgPicture = e.Row.FindControl("imgPicture") as Image; imgPicture.Attributes.Add("onError", String.Format("this.src='{0}Resource/images/no_image.png'", ModulePath)); if (!String.IsNullOrEmpty(ResultDB.Thumbnails)) { if (ResultDB.Thumbnails.IndexOf("http://", StringComparison.CurrentCultureIgnoreCase) >= 0) { imgPicture.ImageUrl = ResultDB.Thumbnails; } else { imgPicture.ImageUrl = String.Format("{0}Results/{1}/{2}", ModulePath, ResultDB.Name, ResultDB.Thumbnails); } } //构造效果标题描述 Label labName = e.Row.FindControl("labName") as Label; Label labDescription = e.Row.FindControl("labDescription") as Label; Label labVersion = e.Row.FindControl("labVersion") as Label; labName.Text = ResultDB.Name; labDescription.Text = ResultDB.Description; labVersion.Text = ResultDB.Version; //演示地址 if (!String.IsNullOrEmpty(ResultDB.DemoUrl)) { Literal LiDemoUrl = e.Row.FindControl("LiDemoUrl") as Literal; LiDemoUrl.Text = String.Format("<a href=\"{0}\" target=\"_blank\" class=\"btn btn-default btn-sm\"><i class=\"fa clip-link\"></i> {1}</a>", ResultDB.DemoUrl, ViewResourceText("labDemoUrl", "Demo Url")); } //响应式 if (ResultDB.Responsive) { Literal LiResponsive = e.Row.FindControl("LiResponsive") as Literal; LiResponsive.Text = String.Format("<a class=\"btn btn-default btn-sm\"><i class=\"fa clip-embed\"></i> {0}</a>", ViewResourceText("labResponsive", "Responsive")); } //应用效果的按钮 LinkButton btnApply = e.Row.FindControl("btnApply") as LinkButton; HyperLink hlThemeName = e.Row.FindControl("hlThemeName") as HyperLink; btnApply.CommandArgument = ResultDB.Name; if (!String.IsNullOrEmpty(Settings_ResultName) && Settings_ResultName == ResultDB.Name)//判断设置效果是否为当前效果 { btnApply.Text = String.Format("<i class=\"fa fa-stop\"></i> {1}", ModulePath, Localization.GetString("btnApply_Stop", this.LocalResourceFile)); btnApply.Enabled = false; btnApply.CssClass = "btn btn-danger"; hlThemeName.Text = String.Format("<i class=\"fa clip-cogs\"></i> {0}", Settings_ResultThemeName); hlThemeName.NavigateUrl = xUrl("Effect_Options"); } else { btnApply.Text = String.Format("<i class=\"fa fa-play-circle-o\"></i> {1}", ModulePath, Localization.GetString("btnApply_Play", this.LocalResourceFile)); btnApply.CssClass = "btn btn-success"; hlThemeName.Visible = false; } } } }
protected void grvAdminParentescoProducto_RowDataBound(object sender, GridViewRowEventArgs e) { }
protected void GridView_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (intBanderaMuestraDescuento < 1) { Label btnDescuento = (Label)e.Row.FindControl("Label2"); btnDescuento.Visible = false; Label btnSimbolo = (Label)e.Row.FindControl("lblsimbolo"); btnSimbolo.Visible = false; } if (intPrecioSinDescuento == 1) { // Label lblPrecio = (Label)e.Row.FindControl("Label8"); lblPrecio.Visible = true; Label lblPrecioDescuento = (Label)e.Row.FindControl("Label4"); lblPrecioDescuento.Visible = false; } if (intMostrarComentarios == 1) { Label lblMostrarComentarios = (Label)e.Row.FindControl("Label12"); lblMostrarComentarios.Visible = true; } } if (e.Row.RowType == DataControlRowType.Header) { if (intBanderaMuestraDescuento < 1) { Label LBLDescuento = (Label)e.Row.FindControl("lblDescuento"); LBLDescuento.Visible = false; } } if (e.Row.RowType == DataControlRowType.Footer) { Label lblsubtsindesc = (Label)e.Row.FindControl("label11"); Label lblsubtsindescval = (Label)e.Row.FindControl("SubtSinDesc"); Label lbldesc = (Label)e.Row.FindControl("label10"); Label lbldescvalue = (Label)e.Row.FindControl("Descuento"); if (descuentogral > 0) { //lblsubtsindesc.Enabled = true; //lblsubtsindescval.Enabled = true; //lblsubtsindesc.Visible = true; //lblsubtsindescval.Visible = true; //lbldesc.Enabled = true; //lbldescvalue.Enabled = true; lbldesc.Visible = true; lbldescvalue.Visible = true; } else { //lblsubtsindesc.Enabled = false; //lblsubtsindescval.Enabled = false; //lbldesc.Enabled = false; //lbldescvalue.Enabled = false; lbldesc.Visible = false; lbldescvalue.Visible = false; //lblsubtsindesc.Visible = false; //lblsubtsindescval.Visible = false; } } }