Wednesday, 26 February 2014

Row DataBound Control public void gvVendorDetails_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { HiddenField hdnFlag = e.Row.FindControl("hdnFlag") as HiddenField; HiddenField hdnAUGBL = e.Row.FindControl("hdnAugBl") as HiddenField; HiddenField hdnAPDSTAT = e.Row.FindControl("hdnAPDSTAT") as HiddenField; //Invoice Status HiddenField hdnInv_Status = e.Row.FindControl("hdnInv_Status") as HiddenField; //LinkButton lnkBarCode = e.Row.FindControl("lnkBarCode") as LinkButton; Label lnkBarCode = e.Row.FindControl("lnkBarCode") as Label; HiddenField hdnEXKEY = e.Row.FindControl("hdnExkey") as HiddenField; Label lblEXKEY = e.Row.FindControl("lblPending") as Label; // Commented by Jagan on 20121120 //Label lblWODOC = e.Row.FindControl("lblDocNo") as Label; //Label lblAUGBL = e.Row.FindControl("lblClearing") as Label; HiddenField hdnDelFlags = e.Row.FindControl("hdnDelFlag") as HiddenField; HiddenField hdnProcessDoc = e.Row.FindControl("hdnProcessDoc") as HiddenField; HiddenField hdnUrl = e.Row.FindControl("hdnUrl") as HiddenField; HiddenField hdnVendorCode = e.Row.FindControl("hdnVendorCode") as HiddenField; HiddenField hdnVendorDetails = e.Row.FindControl("hdnVendorDetails") as HiddenField; HiddenField hdnVendorName = e.Row.FindControl("hdnVendorName") as HiddenField; ImageButton imgbtnShowInvoice = e.Row.FindControl("imgbtnShowInvoice") as ImageButton; ImageButton imgbtnShowPrevApproval = e.Row.FindControl("imgbtnShowPrevApproval") as ImageButton; Label lblCategory = e.Row.FindControl("lblCategory") as Label; string Path = string.Concat(hdnBarCode.Value.Trim(), hdnUrl.Value); lnkBarCode.Attributes.Add("onclick", "return false;"); imgbtnShowInvoice.Attributes.Add("onclick", "return ShowInvoiceImage('" + Path + "','" + lnkBarCode.Text + "');"); imgbtnShowPrevApproval.Visible = false; if (DTBarCode.Rows.Count > 0) { DataView dv = new DataView(DTBarCode); dv.RowFilter = "ITAH_LOGSRLNO ='" + lnkBarCode.Text.Trim() + "'"; if (dv.Count > 0) { imgbtnShowPrevApproval.Visible = true; } else { imgbtnShowPrevApproval.Visible = false; } } imgbtnShowPrevApproval.Attributes.Add("onclick", "return showPreviousApprovals('" + Encrypt(lnkBarCode.Text.Trim(), strSecurityCode) + "')"); Image imgStatus = e.Row.FindControl("imgStatus") as Image; string VendorCode = hdnVendorCode.Value.Trim(); //DataRowView drv = (DataRowView)e.Row.DataItem; if (tmpCategoryName != VendorCode) { tmpCategoryName = VendorCode; // Get a reference to the current row's Parent, which is the Gridview (which happens to be a table) Table tbl = e.Row.Parent as Table; if (tbl != null) { GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal); TableCell cell = new TableCell(); // Span the row across all of the columns in the Gridview cell.ColumnSpan = this.gvVendorDetails.Columns.Count; cell.Width = Unit.Percentage(100); cell.Height = Unit.Percentage(100); cell.Style.Add("font-weight", "bold"); cell.Style.Add("background-color", "#DDFFDD"); cell.Style.Add("color", "#006C00"); HtmlGenericControl span = new HtmlGenericControl("span"); if (hdnVendorDetails.Value.Trim().Length > 0) { span.InnerHtml = hdnVendorCode.Value.Trim() + " - " + hdnVendorDetails.Value.Trim(); } else { span.InnerHtml = hdnVendorCode.Value.Trim() + " - " + hdnVendorName.Value.Trim(); } cell.Controls.Add(span); row.Cells.Add(cell); tbl.Rows.AddAt(tbl.Rows.Count - 1, row); } } if (hdnInv_Status.Value.Trim().ToUpper().Equals("INVOICE RECEIVED.")) { imgStatus.ImageUrl = "Images/invoice_receive.png"; imgStatus.ToolTip = "Invoice Received."; } else if (hdnInv_Status.Value.Trim().ToUpper().Equals("PENDING FOR USER/SPONSOR APPROVAL.")) { imgStatus.ImageUrl = "Images/user-sponsor.png"; imgStatus.ToolTip = "Pending for User/Sponsor Approval."; } else if (hdnInv_Status.Value.Trim().ToUpper().Equals("PENDING FOR CLARIFICATION.")) { imgStatus.ImageUrl = "Images/user-reject.png"; imgStatus.ToolTip = "Pending for Clarification."; } else if (hdnInv_Status.Value.Trim().ToUpper().Equals("WAITING FOR INVOICE PROCESSING.")) { imgStatus.ImageUrl = "Images/Pending-Process.png"; imgStatus.ToolTip = "Waiting for Invoice Processing."; } else if (hdnInv_Status.Value.Trim().ToUpper().Equals("INVOICE PROCESSED, WAITING FOR PAYMENT.")) { imgStatus.ImageUrl = "Images/Process-Completes.png"; imgStatus.ToolTip = "Invoice Processed, Waiting for Payment."; } else if (hdnInv_Status.Value.Trim().ToUpper().Equals("INVOICE PAID.")) { imgStatus.ImageUrl = "Images/paid.png"; imgStatus.ToolTip = "Invoice Paid."; } else if (hdnInv_Status.Value.Trim().ToUpper().Equals("INVOICE PROCESSED, NOT DUE FOR PAYMENT.")) { imgStatus.ImageUrl = "Images/clock_red.png"; imgStatus.ToolTip = "Invoice Processed, Not Due for Payment."; } else if (hdnInv_Status.Value.Trim().ToUpper().Equals("INVOICE REJECTED BY SGGI.")) { imgStatus.ImageUrl = "Images/invoice-delete.png"; imgStatus.ToolTip = "Invoice Rejected By SGGI."; } else { imgStatus.ImageUrl = "Images/empty.png"; imgStatus.ToolTip = ""; } if (hdnDelFlags.Value.Trim().ToString().Equals("X")) { imgStatus.ImageUrl = "Images/invoice-delete.png"; imgStatus.ToolTip = "Invoice Delete."; } e.Row.Cells[8].Attributes.Add("style", "cursor:hand"); e.Row.Cells[8].Attributes.Add("onclick", "return ShowImageDescription()"); } }

No comments:

Post a Comment