protected void GridView_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { TableCellCollection tcc = e.Row.Cells; tcc.Clear(); e.Row.Cells.Add(new TableCell()); e.Row.Cells[0].Attributes.Add("colspan", "4"); e.Row.Cells[0].Text = "总交易数"; e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Center; e.Row.Cells.Add(new TableCell()); e.Row.Cells[1].Text = "";// e.Row.Cells.Add(new TableCell()); e.Row.Cells[2].Text = "总收入";// e.Row.Cells.Add(new TableCell()); e.Row.Cells[3].Text = "";// e.Row.Cells.Add(new TableCell()); e.Row.Cells[4].Attributes.Add("colspan", "8"); e.Row.Cells[4].Text = ""; e.Row.Cells[4].HorizontalAlign = HorizontalAlign.Center; e.Row.Cells.Add(new TableCell()); } if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[0].Attributes.Add("style", "vnd.ms-excel.numberformat:@"); e.Row.Cells[1].Attributes.Add("style", "vnd.ms-excel.numberformat:@"); e.Row.Cells[2].Attributes.Add("style", "vnd.ms-excel.numberformat:@"); e.Row.Cells[3].Attributes.Add("style", "vnd.ms-excel.numberformat:@"); e.Row.Cells[4].Attributes.Add("style", "vnd.ms-excel.numberformat:@"); e.Row.Cells[10].Attributes.Add("style", "vnd.ms-excel.numberformat:@"); e.Row.Cells[11].Attributes.Add("style", "vnd.ms-excel.numberformat:@"); e.Row.Cells[12].Visible = false; e.Row.Cells[16].Visible = false; e.Row.Cells[17].Visible = false; e.Row.Cells[18].Visible = false; e.Row.Cells[19].Visible = false; } //if (e.Row.RowType == DataControlRowType.Header) //{ // e.Row.Cells[1].Text = "3333"; //} }
protected void AuthorityLists_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { TableCellCollection tcHeader = e.Row.Cells; #region 语言 tcHeader[0].Text = ResourceManager.GetString("AuthorityPage_Lab_0"); tcHeader[1].Text = ResourceManager.GetString("AuthorityPage_Lab_1"); tcHeader[2].Text = ResourceManager.GetString("AuthorityPage_Lab_2"); tcHeader[3].Text = ResourceManager.GetString("AuthorityPage_Lab_3"); tcHeader[4].Text = ResourceManager.GetString("AuthorityPage_Lab_4"); tcHeader[5].Text = ResourceManager.GetString("Pub_Lbtn_update"); tcHeader[6].Text = ResourceManager.GetString("Pub_Lbtn_delete"); #endregion } }
private static void RemoveBottomBorder(TableCellCollection cells, int count) { if (count > cells.Count) { return; } for (var index = 0; index < count; ++index) { var gridViewTableCellEx = cells[index] as GridViewTableCellEx; if (gridViewTableCellEx != null) { gridViewTableCellEx._RemoveBottomBorder(true); } } }
protected void GridViewKategoria_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { int row = e.NewSelectedIndex; TableCellCollection zm = GridViewKategoria.Rows[row].Cells; TableCell id_t = zm[0]; TableCell foto_t = zm[3]; string id = id_t.Text; string id_foto = foto_t.Text; //string connectionString = "Data Source='KACZMARZ-EB27C1\\SQLEXPRESS'; Integrated Security=True; Pooling=False; Initial Catalog='Kopera'"; string connectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Kopera.mdf;Integrated Security=True;User Instance=True"; SqlConnection conn = new SqlConnection(connectionString); conn.Open(); string Kategoria = ListBoxKategoriaUsun.SelectedItem.Text; string sqlQuery = "delete from " + Kategoria + " where id=" + id; SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sqlQuery; cmd.ExecuteScalar(); sqlQuery = "select name from Foto where id_foto = '" + id_foto + "';"; SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlQuery, connectionString); DataSet ds = new DataSet(); dataAdapter.Fill(ds, "Foto"); DataTable dt = ds.Tables["Foto"]; for (int i = 0; i < dt.Rows.Count; ++i) { object[] nameFile = dt.Rows[i].ItemArray; File.Delete(Server.MapPath("~/" + Kategoria + "/" + (string)nameFile[0])); } sqlQuery = "delete from foto where id_foto = '" + id_foto + "';"; cmd.CommandText = sqlQuery; cmd.ExecuteScalar(); conn.Close(); WczytajDoUsuniecia(); }
private int GetGroupColSpan(TableCellCollection cells, int idx) { string[] splitedStr = cells[idx].Text.Split(this.HeaderTextSplitChar); int colSpan = 0; if (splitedStr.Length == 1) { return(colSpan); } for (int i = idx; i < cells.Count; i++) { if (cells[i].Text.Split(this.HeaderTextSplitChar)[0] == splitedStr[0]) { colSpan++; } } return(colSpan); }
protected void rdo_CheckChange(object sender, EventArgs e)//点击radioButton变色 { foreach (GridViewRow row in this.gvHomeworkDetails.Rows) { Control ctl1 = row.FindControl("rdoOK"); Control ctl2 = row.FindControl("rdoNO"); TableCellCollection cell = row.Cells; if ((ctl1 as RadioButton).Checked) { this.gvHomeworkDetails.Rows[row.RowIndex].BackColor = c; } if ((ctl2 as RadioButton).Checked) { this.gvHomeworkDetails.Rows[row.RowIndex].BackColor = System.Drawing.Color.SkyBlue; } } }
protected void gvBody_RowDataBound(object sender, GridViewRowEventArgs e) { DataTable dtTitle = MESComment.MesOutSourcePriceSql.GetMarkerCSBreakdownTitle(txtMoNo.Text.Trim()); switch (e.Row.RowType) { case DataControlRowType.Header: TableCellCollection tcHeader = e.Row.Cells; tcHeader.Clear(); tcHeader.Add(new TableHeaderCell()); tcHeader[0].Text = "Color/Pattern"; tcHeader[0].Attributes.Add("bgcolor", "#efefe7"); for (int i = 0; i < dtTitle.Rows.Count; i++) { tcHeader.Add(new TableHeaderCell()); tcHeader[i + 1].Text = dtTitle.Rows[i]["MARKER_ID"].ToString(); } tcHeader.Add(new TableHeaderCell()); tcHeader[dtTitle.Rows.Count + 1].Text = "Totals"; tcHeader[dtTitle.Rows.Count + 1].Attributes.Add("bgcolor", "#efefe7"); break; case DataControlRowType.DataRow: sumValue = 0; for (int i = 0; i < dtTitle.Rows.Count; i++) { sumValue += MesRpt.ParseInt(e.Row.Cells[i + 1].Text.Trim()) * MesRpt.ParseInt(dtTitle.Rows[i]["TOTAL_RATION"].ToString()); } e.Row.Cells[dtTitle.Rows.Count + 1].Text = sumValue.ToString(); for (int i = 0; i <= dtTitle.Rows.Count; i++) { value[i] += MesRpt.ParseInt(e.Row.Cells[i + 1].Text.ToString()); } break; case DataControlRowType.Footer: e.Row.Cells[0].Text = "Totals(Plies)"; for (int i = 0; i <= dtTitle.Rows.Count; i++) { e.Row.Cells[i + 1].Text = value[i].ToString(); } break; } }
// This event is fired each time the summary table renders a row // it displays the appropriate images. private void dgrQuizSummary_ItemDataBound(object sender, DataGridItemEventArgs e) { // Columns holding various fields int m_intColumnCorrect = 3; int m_intColumnImage = 4; // The header/footer rows also fire this event so they must be filtered out. try { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.SelectedItem || e.Item.ItemType == ListItemType.EditItem) { // The table row TableRow trwRow = (TableRow)e.Item; // The table cell collection TableCellCollection tclCells = trwRow.Cells; // Find the Image System.Web.UI.WebControls.Image imgCorrect = (System.Web.UI.WebControls.Image)tclCells[m_intColumnImage].Controls[1]; // Switch image depending on column text imgCorrect.ImageUrl = tclCells[m_intColumnCorrect].Text; if (tclCells[m_intColumnCorrect].Text == bool.TrueString) { imgCorrect.ImageUrl = "/General/Images/tick.gif"; } else { if (tclCells[m_intColumnCorrect].Text == bool.FalseString) { imgCorrect.ImageUrl = "/General/Images/cross.gif"; } else { imgCorrect.Visible = false; } } } } catch (Exception ex) { throw (ex); } }
private void GroupList(SnapList list) { // Add grouping to the Snap list. SnapListGroupInfo group = list.Groups.CreateSnapListGroupInfo( new SnapListGroupParam("CategoryID", ColumnSortOrder.Ascending)); list.Groups.Add(group); // Add a group header. SnapDocument groupHeader = group.CreateHeader(); Table headerTable = groupHeader.Tables.Create(groupHeader.Range.End, 1, 1); headerTable.SetPreferredWidth(50 * 100, WidthType.FiftiethsOfPercent); TableCellCollection groupHeaderCells = headerTable.FirstRow.Cells; groupHeader.InsertText(groupHeaderCells[0].ContentRange.End, "Category ID: "); groupHeader.CreateSnText(groupHeaderCells[0].ContentRange.End, "CategoryID"); // Customize the group header formatting. groupHeaderCells[0].BackgroundColor = System.Drawing.Color.LightGray; groupHeaderCells[0].Borders.Bottom.LineColor = System.Drawing.Color.White; groupHeaderCells[0].Borders.Left.LineColor = System.Drawing.Color.White; groupHeaderCells[0].Borders.Right.LineColor = System.Drawing.Color.White; groupHeaderCells[0].Borders.Top.LineColor = System.Drawing.Color.White; // Add a group footer. SnapDocument groupFooter = group.CreateFooter(); Table footerTable = groupFooter.Tables.Create(groupFooter.Range.End, 1, 1); footerTable.SetPreferredWidth(50 * 100, WidthType.FiftiethsOfPercent); TableCellCollection groupFooterCells = footerTable.FirstRow.Cells; groupFooter.InsertText(groupFooterCells[0].ContentRange.End, "Count = "); groupFooter.CreateSnText(groupFooterCells[0].ContentRange.End, @"CategoryID \sr Group \sf Count"); // Customize the group footer formatting. groupFooterCells[0].BackgroundColor = System.Drawing.Color.LightGray; groupFooterCells[0].Borders.Bottom.LineColor = System.Drawing.Color.White; groupFooterCells[0].Borders.Left.LineColor = System.Drawing.Color.White; groupFooterCells[0].Borders.Right.LineColor = System.Drawing.Color.White; groupFooterCells[0].Borders.Top.LineColor = System.Drawing.Color.White; }
/// <summary> /// A row has been added to the throughput/receiver table; this is where we do any necessary /// highlighting of row cells. /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.DataRow) { return; } TableCellCollection cells = e.Row.Cells; // throughput data starts in column #2 for (int i = 2; i < cells.Count; i++) { if (cells[i].Text.Equals("no data")) { cells[i].Text = "<i>" + cells[i].Text + "</i>"; highlightCell(cells[i]); } } }
// 适宜性目标矩阵表头设置 protected void SuitfactGrid_RowCreated(object sender, GridViewRowEventArgs e) { switch (e.Row.RowType) { case DataControlRowType.Header: //总表头 TableCellCollection tcHeader = e.Row.Cells; tcHeader.Clear(); //给表头命名 tcHeader.Add(new TableHeaderCell()); tcHeader[0].Text = ""; tcHeader.Add(new TableHeaderCell()); tcHeader[1].Text = lsSuitName[0]; tcHeader.Add(new TableHeaderCell()); tcHeader[2].Text = lsSuitName[1]; break; } }
private void SetReserveFieldsHeaderColumnsCaption_MasterMonthlyOperation(Table table) { BPersonMonthlyWorkedTime MonthlyOperationBusiness = new BPersonMonthlyWorkedTime(0); TableCellCollection gcc = table.Rows[0].Cells; IDictionary <ConceptReservedFields, string> ConceptsReservedFieldsReservedFieldsDic = MonthlyOperationBusiness.GetReservedFieldsNames(); foreach (string conceptReservedFieldName in Enum.GetNames(typeof(ConceptReservedFields))) { for (int i = 0; i < gcc.Count; i++) { if (gcc[i].ID == conceptReservedFieldName) { //gcc[i].Text = MonthlyOperationBusiness.GetReservedFieldsName((ConceptReservedFields)Enum.Parse(typeof(ConceptReservedFields), conceptReservedFieldName)); gcc[i].Text = ConceptsReservedFieldsReservedFieldsDic[(ConceptReservedFields)Enum.Parse(typeof(ConceptReservedFields), conceptReservedFieldName)]; break; } } } }
/// <summary> /// Edits the details of the specific user. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void edit_Click(object sender, EventArgs e) { Button button = sender as Button; string id = button.ID; TableRow row = (button.Parent as TableCell).Parent as TableRow; TableCellCollection cells = row.Cells; string username = cells[0].Text; if (username == Session["username"].ToString()) { Response.Redirect("ManageAccount.aspx"); } else { Session["changingUsername"] = username; Response.Redirect("ManageOtherAccounts.aspx"); } }
public void SetFooter(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { TableCellCollection cells = e.Row.Cells; cells.RemoveAt(0); cells.RemoveAt(0); cells[0].ColumnSpan = 3; if (uxSearchFilter.SearchFilterObj.FilterType != SearchFilter.SearchFilterType.None) { if (uxSearchFilter.SearchFilterObj.Value2 != "") { if (uxSearchFilter.SearchFilterObj.FilterType == SearchFilter.SearchFilterType.Date) { cells[0].Text = uxSearchFilter.SearchFilterObj.FieldName + "<br> from " + DateTime.Parse(uxSearchFilter.SearchFilterObj.Value1).ToString("MMMM d, yyyy") + " to " + DateTime.Parse(uxSearchFilter.SearchFilterObj.Value2).ToString("MMMM d, yyyy"); } else { cells[0].Text = uxSearchFilter.SearchFilterObj.FieldName + "<br> from " + uxSearchFilter.SearchFilterObj.Value1 + " to " + uxSearchFilter.SearchFilterObj.Value2; } } else { cells[0].Text = uxSearchFilter.SearchFilterObj.FieldName + " from " + uxSearchFilter.SearchFilterObj.Value1; } } else { cells[0].Text = " Show All "; } cells[0].CssClass = "pdl10"; cells[1].Text = "Total"; cells[1].HorizontalAlign = HorizontalAlign.Center; cells[1].Font.Bold = true; cells[2].Text = AdminUtilities.FormatPrice(TotalPrice()); cells[2].CssClass = "OrderListTotalPrice"; } }
/// <summary> /// Perform highlighting for the loss rate table /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.DataRow) { return; } // GridView gridView = (GridView)sender; // DataTable table = (DataTable) gridView.DataSource; TableCellCollection cells = e.Row.Cells; // data starts in column #2 for (int i = 2; i < cells.Count; i++) { String text = cells[i].Text; if (text == null) { continue; } // highlight cells with no data if (cells[i].Text.Equals("no data")) { cells[i].Text = "<i>" + cells[i].Text + "</i>"; highlightCell(cells[i]); continue; } // highlight cells with a loss rate above the threshold try { String[] toks = text.Split(null); // whitespace split double rate = double.Parse(toks[0]); if (rate > LOSS_HIGHLIGHT_THRESHOLD) { highlightCell(cells[i]); } } catch (Exception) { } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { TableCellCollection tableCellCollection = e.Row.Cells; foreach (DataControlFieldCell item in tableCellCollection) { if (item.ContainingField.HeaderText == "myOwnText") { item.Text = "hello"; } if (item.ContainingField.HeaderText == "CustomerID") { item.Text = item.Text + "myEdit"; } } } }
protected void btn3_Click(object sender, EventArgs e) { string TE001TE002 = ""; string TE001TE002TE003 = ""; Grid2.EditIndex = -1; foreach (GridViewRow gvr in this.Grid2.Rows) { Control ctl = gvr.FindControl("CheckBox"); CheckBox ck = (CheckBox)ctl; if (ck.Checked) { TableCellCollection cell = gvr.Cells; TE001TE002 += "'" + cell[2].Text + cell[3].Text + "',"; } } foreach (GridViewRow gvr in this.Grid2.Rows) { Control ctl = gvr.FindControl("CheckBox"); CheckBox ck = (CheckBox)ctl; if (ck.Checked) { TableCellCollection cell = gvr.Cells; TE001TE002TE003 += "'" + cell[2].Text + cell[3].Text + cell[4].Text + "',"; } } TE001TE002 += "''"; TE001TE002TE003 += "''"; Label5.Text = TE001TE002.ToString(); Label7.Text = TE001TE002TE003.ToString(); string SQL = SETSQL2(Label7.Text, Label5.Text); UPDATECOPTCCOPTD2(SQL); BindGrid2(txtDate2.Text); }
protected void Grid_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { DataTable dtGroup = GetGroupHeader(); TableCellCollection tcl = e.Row.Cells; tcl.Clear(); tcl.Add(new TableHeaderCell()); tcl[0].Text = "单位"; tcl[0].Wrap = false; tcl[0].RowSpan = 2; tcl.Add(new TableHeaderCell()); tcl[1].Text = "班组长总数"; tcl[1].Wrap = false; tcl[1].RowSpan = 2; tcl.Add(new TableHeaderCell()); tcl[2].Text = "其中</th></tr>"; tcl[2].Wrap = false; tcl[2].ColumnSpan = dtGroup.Rows.Count; int n = 3; foreach (DataRow r in dtGroup.Rows) { tcl.Add(new TableHeaderCell()); tcl[n].Text = r["LEVEL_NAME"].ToString(); tcl[n].Wrap = false; n++; } } if (e.Row.RowType == DataControlRowType.Header) { e.Row.Attributes.Add("class", "HeadingRow"); } if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onclick", "selectCol(this)"); } }
public static void GetGridViewHeader(GridView grid, TableCellCollection cells) { GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert); List<TableCell> collection = new List<TableCell>(); foreach (TableCell x in cells) { string[] headerText = x.Text.Split('_'); var oTableCell = new TableCell(); var count = headerText.Count(); if (count > 1) { if (!collection.Exists(cell => cell.Text == headerText[0])) { oTableCell.Text = headerText[0]; } x.Text = headerText[1]; } else { oTableCell.Text = string.Empty; } collection.Add(oTableCell); } row.Cells.AddRange(collection.ToArray()); row.BackColor = System.Drawing.Color.White; row.Font.Bold = true; grid.Controls[0].Controls.AddAt(0, row); }
//Theme gridview event private void GridView3_RowCommand(object sender, GridViewCommandEventArgs e) { GridView grid = sender as GridView; TableCellCollection tc = grid.Rows[(grid.PageSize - 1) * grid.PageIndex + Int32.Parse((String)e.CommandArgument)].Cells; switch (e.CommandName) { case "Enable": dbAccess.setThemeStatus(Int32.Parse(tc[0].Text), dbAccess.getStatus("Active")); tc[2].Text = "2"; break; case "Disable": dbAccess.setThemeStatus(Int32.Parse(tc[0].Text), dbAccess.getStatus("Disabled")); tc[2].Text = "3"; break; default: break; } }
private void Form1_Load(object sender, EventArgs e) { #region #datasource DevExpress.Spreadsheet.Workbook wb = new DevExpress.Spreadsheet.Workbook(); wb.LoadDocument("Employees.xlsx"); DevExpress.Spreadsheet.RangeDataSourceOptions options = new DevExpress.Spreadsheet.RangeDataSourceOptions(); options.UseFirstRowAsHeader = true; options.CellValueConverter = new MyPictureProvider(wb.Worksheets[0]); options.DataSourceColumnTypeDetector = new MyColumnDetector(); string dsName = wb.Worksheets[0].Tables[0].Name; object ds = wb.Worksheets[0].Tables[0].GetDataSource(options); snapControl1.DataSources.Add(dsName, ds); #endregion #datasource snapControl1.CreateNewDocument(); SnapList list = snapControl1.Document.CreateSnList(snapControl1.Document.Range.End, "EmployeeList"); list.BeginUpdate(); list.DataSourceName = dsName; SnapDocument listHeader = list.ListHeader; Table listHeaderTable = listHeader.Tables.Create(listHeader.Range.End, 1, 3); TableCellCollection listHeaderCells = listHeaderTable.FirstRow.Cells; listHeader.InsertText(listHeaderCells[0].ContentRange.End, "First Name"); listHeader.InsertText(listHeaderCells[1].ContentRange.End, "Last Name"); listHeader.InsertText(listHeaderCells[2].ContentRange.End, "Photo"); SnapDocument listRow = list.RowTemplate; Table listRowTable = listRow.Tables.Create(listRow.Range.End, 1, 3); TableCellCollection listRowCells = listRowTable.FirstRow.Cells; listRow.CreateSnText(listRowCells[0].ContentRange.End, "\"First Name\""); listRow.CreateSnText(listRowCells[1].ContentRange.End, "\"Last Name\""); listRow.CreateSnImage(listRowCells[2].ContentRange.End, "Photo"); list.EndUpdate(); list.Field.Update(); }
protected void Schedule_delete(object sender, GridViewDeleteEventArgs e) { output.Text = ""; if (sender.GetType() == typeof(GridView)) { GridView GR = (GridView)sender; GR.SelectRow(e.RowIndex); TableCellCollection DC = GR.SelectedRow.Cells; MySqlCommand removeSchedule = new MySqlCommand("DELETE FROM schakelschema WHERE (`apparaatid` IN (SELECT `apparaatid` FROM apparaat WHERE `naam` = :naam)) AND (`tijd` = :tijd)"); removeSchedule.Parameters.Add("naam", DC[1].Text); removeSchedule.Parameters.Add("tijd", Convert.ToDateTime(DC[5].Text)); if (!global.ExecuteChanger(removeSchedule, out string removeSchedule_error)) { global.generic_QueryErrorHandler(removeSchedule, removeSchedule_error); /* do something with the error */ } else { output.Text = DC[1].Text + " om " + DC[2].Text + " verwijdert"; DataTable dt = global.GetScheduleTable(); if (dt.Rows.Count == 0) { DataRow emp_dr = dt.NewRow(); emp_dr["apparaat"] = "Currently"; emp_dr["tijd"] = "No"; emp_dr["stand"] = "Devices"; emp_dr["temp"] = "Scheduled"; emp_dr["hidden"] = DateTime.Now; dt.Rows.Add(emp_dr); global.show_delete_btn = false; } else { global.show_delete_btn = true; } ScheduleDisplayer.DataSource = dt; ScheduleDisplayer.DataBind(); } } }
private void AddCells(TableCellCollection cells, FmriRequest req) { TableCell c; c = new TableCell(); c.Text = req.ImageName; cells.Add(c); c = new TableCell(); c.Text = "" + req.X1 + "-" + req.X2; cells.Add(c); c = new TableCell(); c.Text = "" + req.Y1 + "-" + req.Y2; cells.Add(c); c = new TableCell(); c.Text = "" + req.Z1 + "-" + req.Z2; cells.Add(c); c = new TableCell(); c.Text = Convert.ToString(req.Threshold); cells.Add(c); c = new TableCell(); c.Text = "" + req.T1 + "-" + req.T2; cells.Add(c); c = new TableCell(); c.Text = "" + req.CS1 + "-" + req.CS2; cells.Add(c); c = new TableCell(); c.Text = req.IPAddress; cells.Add(c); c = new TableCell(); c.Text = Convert.ToString(req.TimeSubmitted); cells.Add(c); }
protected void gvAdviserInterestRates_RowUpdating(object sender, GridViewUpdateEventArgs e) { DataTable dt = (DataTable)ViewState["CurrentTable"]; string editKey = gvAdviserInterestRates.DataKeys[e.RowIndex].Value.ToString(); // DataTable dtTemp = dt.Clone(); for (int i = 0; i < gvAdviserInterestRates.Rows.Count; i++) { //DataRow dr = dtTemp.NewRow(); if (dt.Rows[i]["ALSIR_LoanSchemeInterestRateId"].ToString() == editKey) { //dtTemp.Rows.Add(dt.Rows[i]); //dt.Rows[i]. //DataRow dr = dt.NewRow(); TableCellCollection row = gvAdviserInterestRates.Rows[i].Cells; //dr["ALSIR_LoanSchemeInterestRateId"] = gvAdviserInterestRates.FindControl(""); // dt.Rows[i]["ALSIR_LoanSchemeInterestRateId"]; dt.Rows[i]["ALSIR_InterestCategory"] = ((TextBox)row[1].FindControl("txtCategory")).Text; dt.Rows[i]["ALSIR_MinimumFinance"] = ((TextBox)row[2].FindControl("txtMinFinance")).Text; dt.Rows[i]["ALSIR_MaximumFinance"] = ((TextBox)row[3].FindControl("txtMaxFinance")).Text; dt.Rows[i]["ALSIR_MinimumPeriod"] = ((TextBox)row[4].FindControl("txtMinimumPeriod")).Text; dt.Rows[i]["ALSIR_MaximumPeriod"] = ((TextBox)row[5].FindControl("txtMaximumPeriod")).Text; dt.Rows[i]["ALSIR_DifferentialInterestRate"] = ((TextBox)row[6].FindControl("txtDifferentialInterestRate")).Text; dt.Rows[i]["ALSIR_MaximumFinancePer"] = ((TextBox)row[7].FindControl("txtMaximumFinancePer")).Text; dt.Rows[i]["ALSIR_ProcessingCharges"] = ((TextBox)row[8].FindControl("txtProcessingCharges")).Text; dt.Rows[i]["ALSIR_PreClosingCharges"] = ((TextBox)row[9].FindControl("txtPreClosingCharges")).Text; dt.Rows[i]["ALSIR_LoanSchemeInterestRateId"] = editKey; //dt.Rows.Add(dr); } } ViewState["CurrentTable"] = dt; gvAdviserInterestRates.EditIndex = -1; gvAdviserInterestRates.DataSource = (DataTable)ViewState["CurrentTable"]; gvAdviserInterestRates.DataBind(); DisplayFooter(); }
public void SetFooter(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { if (_table != null) { decimal total = 0; decimal numberOfOrder = 0; decimal quantity = 0; for (int x = 0; x < _table.Rows.Count; x++) { total += ConvertUtilities.ToDecimal(_table.Rows[x]["Total"].ToString()); numberOfOrder += ConvertUtilities.ToInt32(_table.Rows[x]["NumberOfOrder"].ToString()); quantity += ConvertUtilities.ToInt32(_table.Rows[x]["Quantity"].ToString()); } TableCellCollection cells = e.Row.Cells; cells[0].Text = " Total "; cells[0].HorizontalAlign = HorizontalAlign.Center; cells[0].Font.Bold = true; cells[1].CssClass = "TotalReport"; cells[1].Text = AdminUtilities.FormatPrice(total); cells[2].CssClass = "TotalQuantity"; cells[2].Text = "" + numberOfOrder; cells[3].CssClass = "TotalReport"; cells[3].Text = AdminUtilities.FormatPrice(total / numberOfOrder); cells[4].CssClass = "TotalQuantity"; cells[4].Text = "" + quantity; cells[5].CssClass = "TotalQuantity"; cells[5].Text = "" + (quantity / numberOfOrder); } } }
//protected void cboTheme_SelectedIndexChanged(object sender, EventArgs e) //{ // ThemesCSS.Attributes.Add("href", "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/" + cboTheme.SelectedValue + "/ui.all.css"); // SaveThemesCookie(cboTheme.SelectedValue); // BindGrid(); //} protected void grd_OnRowDataBound(object sender, GridViewRowEventArgs e) { EFDal ed = new EFDal(); if (e.Row.RowType == DataControlRowType.DataRow) { TableCellCollection cells = e.Row.Cells; cells[2].Text = ed.IKBSPersonelUNdenTurkceAdiDon(Guid.Parse(cells[2].Text));//"Alan"; cells[3].Text = ed.IKBSPersonelUNdenTurkceAdiDon(Guid.Parse(cells[3].Text)); //Button btnSave = (Button)e.Row.Cell[6].Controls[0]; Button btnSave = (Button)e.Row.Cells[6].Controls[0]; if (!ed.KullaniciBelirliBirRoleSahipMi(Context.User.Identity.Name, "Mudur")) { btnSave.Enabled = true; } else { btnSave.Enabled = false; } } }
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { switch (e.Row.RowType) { case DataControlRowType.Header: //第一行表头 TableCellCollection tcHeader = e.Row.Cells; tcHeader.Clear(); tcHeader.Add(new TableHeaderCell()); tcHeader[0].Text = "用户名"; tcHeader.Add(new TableHeaderCell()); tcHeader[1].Text = "权限"; tcHeader.Add(new TableHeaderCell()); tcHeader[2].Text = "所属机构"; tcHeader.Add(new TableHeaderCell()); tcHeader[3].Attributes.Add("colspan", "2"); tcHeader[3].Text = "操作"; tcHeader.Add(new TableHeaderCell()); tcHeader[4].Text = "重置密码"; break; } }
protected void gvReport_OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { TableCellCollection cells = e.Row.Cells; foreach (TableCell cell in cells) { cell.Text = Server.HtmlDecode(cell.Text); cell.Attributes.Add("style", "white-space: nowrap;"); } } else { TableCellCollection cells = e.Row.Cells; foreach (TableCell cell in cells) { cell.Attributes.Add("style", "white-space: nowrap;"); } } }
private void CustomerBind() { DataSet Data = new DataSet(); ManageUserSVC.ManageUserClient Client = new ManageUserSVC.ManageUserClient(); Data = Client.GetAllCustomers(); //MKP Solved existing issue when grid have one customer than it deleted it is not automaic refresh the grid //if (Data != null && Data.Tables[0].Rows.Count > 0) { grdCustomers.DataSource = Data; grdCustomers.DataBind(); grdCustomers.UseAccessibleHeader = true; grdCustomers.HeaderRow.TableSection = TableRowSection.TableHeader; TableCellCollection cells = grdCustomers.HeaderRow.Cells; cells[0].Attributes.Add("data-class", "expand"); //cells[2].Attributes.Add("data-hide", "phone,tablet"); cells[3].Attributes.Add("data-hide", "phone,tablet"); cells[4].Attributes.Add("data-hide", "phone,tablet"); //cells[5].Attributes.Add("data-hide", "phone,tablet"); //cells[6].Attributes.Add("data-hide", "phone,tablet"); } }
protected void rdo_CheckChange(object sender, EventArgs e)//点击radioButton变色 { foreach (GridViewRow row in this.gvAttendanceDetails.Rows) { Control ctl1 = row.FindControl("rdoNormal"); Control ctl2 = row.FindControl("rdoLate"); Control ctl3 = row.FindControl("rdoAbsence"); Control ctl4 = row.FindControl("rdoEarly"); Control ctl5 = row.FindControl("rdoLeave"); TableCellCollection cell = row.Cells; if ((ctl1 as RadioButton).Checked) { //this.gvAttendanceDetails.Rows[row.DataItemIndex].BackColor = c; this.gvAttendanceDetails.Rows[row.RowIndex].BackColor = c; } if ((ctl2 as RadioButton).Checked) { //this.gvAttendanceDetails.Rows[row.DataItemIndex].BackColor = System.Drawing.Color.Blue; this.gvAttendanceDetails.Rows[row.RowIndex].BackColor = System.Drawing.Color.Blue; } if ((ctl3 as RadioButton).Checked) { //this.gvAttendanceDetails.Rows[row.DataItemIndex].BackColor = System.Drawing.Color.Pink; this.gvAttendanceDetails.Rows[row.RowIndex].BackColor = System.Drawing.Color.Pink; } if ((ctl4 as RadioButton).Checked) { //this.gvAttendanceDetails.Rows[row.DataItemIndex].BackColor = System.Drawing.Color.Yellow; this.gvAttendanceDetails.Rows[row.RowIndex].BackColor = System.Drawing.Color.Yellow; } if ((ctl5 as RadioButton).Checked) { //this.gvAttendanceDetails.Rows[row.DataItemIndex].BackColor = System.Drawing.Color.Red; this.gvAttendanceDetails.Rows[row.RowIndex].BackColor = System.Drawing.Color.Red; } } }
protected void gvconsist_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { TableCellCollection cell = e.Row.Cells; cell[0].Attributes.Add("data-title", "Constituency No"); cell[1].Attributes.Add("data-title", "Name"); cell[2].Attributes.Add("data-title", "TDP"); cell[3].Attributes.Add("data-title", "YSRCP"); cell[4].Attributes.Add("data-title", "Janasena"); //cell[5].Attributes.Add("data-title", "BJP"); } if (e.Row.RowType == DataControlRowType.DataRow) { Label lbljanasena = (Label)e.Row.FindControl("lbljanasena"); Label lbltdp = (Label)e.Row.FindControl("lbltdp"); Label lblysrcp = (Label)e.Row.FindControl("lblysrcp"); // Label lblbjp = (Label)e.Row.FindControl("lblbjp"); foreach (string str in UserPredicts) { if (str == lbljanasena.Text) { e.Row.Cells[4].Attributes.Add("class", "janasena"); } else if (str == lbltdp.Text) { e.Row.Cells[2].Attributes.Add("class", "tdp"); } else if (str == lblysrcp.Text) { e.Row.Cells[3].Attributes.Add("class", "ysrcp"); } //else if (str == lblbjp.Text) // e.Row.Cells[5].Attributes.Add("class", "bjp"); } } }
//...................................................... // // Table Selection // //...................................................... private static TableCell FindCellAtColumnIndex(TableCellCollection cells, int columnIndex) { for (int cellIndex = 0; cellIndex < cells.Count; cellIndex++) { TableCell cell; int startColumnIndex; int endColumnIndex; cell = cells[cellIndex]; startColumnIndex = cell.ColumnIndex; endColumnIndex = startColumnIndex + cell.ColumnSpan - 1; if (startColumnIndex <= columnIndex && columnIndex <= endColumnIndex) { return cell; } } return null; }
private void ColorMarkerColumnIndexs(TableCellCollection cells) { List<Dictionary<int, Color>> columnIndexList = new List<Dictionary<int, Color>>(); if (ViewState["color_maker"] != null) { color_markers cm = (color_markers)ViewState["color_maker"]; for (int i = 0; i < cm.Count; i++) { string auxColumnName = cm.GetName(i).ToLower(); Color auxColumnColor = cm.GetColor(i); for (int j = 0; j < cells.Count; j++) { DataControlFieldCell cell = (DataControlFieldCell)cells[j]; if (cell.ContainingField.ToString().ToLower() == auxColumnName) { columnIndexList.Add(new Dictionary<int, Color> { { j, auxColumnColor } }); } } } // creates an object that in can be used in the row data bound that is faster ViewState["color_maker_column_index"] = columnIndexList; } }