当前位置: 首页>>代码示例>>C#>>正文


C# GridViewRow类代码示例

本文整理汇总了C#中GridViewRow的典型用法代码示例。如果您正苦于以下问题:C# GridViewRow类的具体用法?C# GridViewRow怎么用?C# GridViewRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GridViewRow类属于命名空间,在下文中一共展示了GridViewRow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GridView1_DataBound

    protected void GridView1_DataBound(object sender, EventArgs e)
    {
        if (GridView1.Rows.Count > 0)
        {
            Table tbl = (Table)GridView1.Controls[0];
            GridViewRow row = new GridViewRow(1, -1, DataControlRowType.Header, DataControlRowState.Normal);
            string msg = " ";
            if (rsQty == limitQty)
                msg = "Warning: Your search result has reached the limit of the number of " + limitQty.ToString();

            TableCell th = new TableHeaderCell();
            th.ColumnSpan = 6;
            th.Text = msg;
            row.Cells.Add(th);
            TableCell thQty = new TableHeaderCell();
            thQty.Text = "Total Qty<br/>" + totalQty.ToString();
            thQty.ForeColor = System.Drawing.Color.Red;
            thQty.HorizontalAlign = HorizontalAlign.Right;
            row.Cells.Add(thQty);
            TableCell thAmt = new TableHeaderCell();
            thAmt.Text = "Total Amount<br/>" + totalAmt.ToString();
            row.Cells.Add(thAmt);
            thAmt.ForeColor = System.Drawing.Color.Red;
            thAmt.HorizontalAlign = HorizontalAlign.Right;
            TableCell th2 = new TableHeaderCell();
            th2.ColumnSpan = 8;
            th2.Text = "&nbsp";
            row.Cells.Add(th2);
            tbl.Rows.AddAt(1, row);
        }
    }
开发者ID:rivernli,项目名称:pMKT,代码行数:31,代码来源:HubInvDetail.aspx.cs

示例2: CellWrap

 public static void CellWrap(GridViewRow row, int from)
 {
     for (int i = from; i < row.Cells.Count - 1; i++)
     {
       row.Cells[i].Attributes.Add("style", "WORD-BREAK:BREAK-ALL");
     }
 }
开发者ID:AdamsChao,项目名称:netdb-localdev-proj,代码行数:7,代码来源:Utils.cs

示例3: InsertData

    private void InsertData(GridViewRow gRow)
    {
        TextBox txtBarcode = (TextBox)gRow.Cells[1].FindControl("txtNewBarcode");
        TextBox txtAbbname = (TextBox)gRow.Cells[2].FindControl("txtNewAbbname");
        TextBox txtMultiply = (TextBox)gRow.Cells[3].FindControl("txtNewMultiply");
        DropDownList cmbUnit = (DropDownList)gRow.Cells[5].FindControl("cmbNewUnit");
        TextBox txtCost = (TextBox)gRow.Cells[6].FindControl("txtNewCost");
        TextBox txtPrice = (TextBox)gRow.Cells[7].FindControl("txtNewPrice");
        CheckBox chkIsVAT = (CheckBox)gRow.Cells[8].FindControl("chkNewIsVAT");
        CheckBox chkIsDiscount = (CheckBox)gRow.Cells[9].FindControl("chkNewIsDiscount");
        TextBox txtPackSize = (TextBox)gRow.Cells[10].FindControl("txtNewPackSize");
        DropDownList cmbUnitPack = (DropDownList)gRow.Cells[11].FindControl("cmbNewUnitPack");

        ProductBarcodeData data = new ProductBarcodeData();
        data.UNITMASTER = FlowObj.GetUnitName(this.txtMasterUnit.Text);
        //data.UNITPACK = FlowObj.GetUnitName(this.txtPackSizeUint.Text);
        data.BARCODE = txtBarcode.Text.Trim();
        data.ABBNAME = txtAbbname.Text.Trim();
        data.MULTIPLY = Convert.ToDouble(txtMultiply.Text == "" ? "0" : txtMultiply.Text);
        data.UNIT = Convert.ToDouble(cmbUnit.SelectedValue);
        data.UNITPACK = Convert.ToDouble(cmbUnitPack.SelectedValue);
        data.COST = Convert.ToDouble(txtCost.Text == "" ? "0" : txtCost.Text);
        data.PRICE = Convert.ToDouble(txtPrice.Text == "" ? "0" : txtPrice.Text);
        data.ISVAT = (chkIsVAT.Checked ? "1" : "0");
        data.ISDISCOUNT = (chkIsDiscount.Checked ? "1" : "0");
        data.PACKSIZE = Convert.ToDouble(txtPackSize.Text == "" ? "0" : txtPackSize.Text);

        if (ItemObj.InsertItem(data))
        {
            this.grvItem.DataBind();
        }
        else
            Appz.ClientAlert(this, ItemObj.ErrorMessage);
    }
开发者ID:SoftSuite,项目名称:ABB,代码行数:34,代码来源:ProductBarcode.aspx.cs

示例4: grdSearchResult_SelectedIndexChanged

    //End:-- code changes by sumit as on 28th April for special char implentetation
    protected void grdSearchResult_SelectedIndexChanged(object sender, EventArgs e)
    {
        string gridviewvalue = grdSearchResult.SelectedDataKey.Value.ToString();
        //hiddenSiteName.Value = grdSearchResult.Selected);   //grdSearchResult[1,grdSearchResult.SelectedIndex].ToString();
        hiddenText.Value = gridviewvalue;

        GridViewRow[] rowArray = new GridViewRow[grdSearchResult.Rows.Count];
        grdSearchResult.Rows.CopyTo(rowArray, 0);

        // Iterate though the array and display the value in the first cell of the row.
        int j = -1;
        foreach (GridViewRow row in rowArray)
        {
            j++;
            if (j == grdSearchResult.SelectedIndex)
            {
                hiddenSiteName.Value = row.Cells[1].Text;
            }
        }

        if (ViewState["PageName"] != null)
        {
            Server.Transfer(Convert.ToString(ViewState["PageName"]), true);
        }
    }
开发者ID:raverma,项目名称:SiteImportManager,代码行数:26,代码来源:SiteHelp.aspx.cs

示例5: GridView1_RowCreated

    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
        {
        }
    }
开发者ID:hpie,项目名称:hpie,代码行数:26,代码来源:marks_detail_view.aspx.cs

示例6: NewRowDataBound

 private void NewRowDataBound(GridViewRow gRow)
 {
     //ComboSource.BuildCombo((DropDownList)gRow.Cells[3].FindControl("cmbNewProduct"), "V_PRODUCT_RETURNREQUEST", "NAME", "LOID", "NAME", "", "àÅ×Í¡", "0");
     ControlUtil.SetIntTextBox((TextBox)gRow.Cells[4].FindControl("txtNewPDQty"));
     ControlUtil.SetIntTextBox((TextBox)gRow.Cells[5].FindControl("txtNewQty"));
     ControlUtil.SetIntTextBox((TextBox)gRow.Cells[6].FindControl("txtNewUnit"));
     string script = "document.getElementById('" + ((TextBox)gRow.Cells[5].FindControl("txtNewQty")).ClientID + "').value * ";
     ((TextBox)gRow.Cells[4].FindControl("txtNewQty")).Attributes.Add("onchange", script);
 }
开发者ID:SoftSuite,项目名称:ABB,代码行数:9,代码来源:StockinProduction.aspx.cs

示例7: RowOnMouseOverEvent

 protected void RowOnMouseOverEvent(GridViewRow row, string keyFieldName, string editPage)
 {
     if (row.RowType == DataControlRowType.DataRow)
     {
         row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ffffcc'");
         row.Attributes.Add("onmouseout", "this.style.backgroundColor=''");
         row.Attributes.Add("onclick", "itemClick('" + editPage + "?id=" + DataBinder.Eval(row.DataItem, keyFieldName) + "')");
     }
 }
开发者ID:solo123,项目名称:AGMV,代码行数:9,代码来源:AdminList.cs

示例8: RowOnMouseOverEvent1

 protected void RowOnMouseOverEvent1(GridViewRow row, string editPage)
 {
     if (row.RowType == DataControlRowType.DataRow)
     {
         row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ffffcc'");
         row.Attributes.Add("onmouseout", "this.style.backgroundColor=''");
         row.Attributes.Add("onclick", "itemClick(\"" + editPage + "\")");
     }
 }
开发者ID:solo123,项目名称:AGMV,代码行数:9,代码来源:AdminList.cs

示例9: SetSortDirectionImage

 public static void SetSortDirectionImage(GridView gridView, GridViewRow headerRow,
 string sortExpression, SortDirection sortDirection)
 {
     int sortColumnIndex = GetSortColumnIndex(gridView, sortExpression);
     if (sortColumnIndex != -1)
     {
         AddSortImage(headerRow, sortColumnIndex, sortDirection);
     }
 }
开发者ID:TelerikAcademy,项目名称:QA-Academy,代码行数:9,代码来源:SortingUtility.cs

示例10: BindGrid

    public void BindGrid()
    {
        DataTable dt = getTable();
        if (dt != null)
        {
            if (dt.Rows.Count > 0)
            {
                btnExport.Visible = true;
                grdProdData.DataSource = dt;

                //helper = new GridViewHelper(this.grdProdData);
                //helper.RegisterGroup("Group", true, true);
                //helper.GroupSummary += helper_GroupSummary;
                //helper.RegisterSummary("Quantity", SummaryOperation.Sum, "Group");
                grdProdData.DataBind();
                int Total = 0;
                foreach (GridViewRow gr in grdProdData.Rows)
                {
                    Total = Total + Convert.ToInt32(((LinkButton)gr.FindControl("lnkQuantity")).Text);
                }
                GridViewRow oGridViewRow = new GridViewRow(grdProdData.Rows.Count+1, 14, DataControlRowType.Footer, DataControlRowState.Insert);

                TableCell oTableCell = new TableCell();
                oTableCell.Text = "";
                oTableCell.HorizontalAlign = HorizontalAlign.Center;
                oGridViewRow.Cells.Add(oTableCell);

                oTableCell = new TableCell();
                oTableCell.Text = "Total:";
                oTableCell.HorizontalAlign = HorizontalAlign.Center;
                oGridViewRow.Cells.Add(oTableCell);

                oTableCell = new TableCell();
                oTableCell.Text = Total.ToString();
                oTableCell.HorizontalAlign = HorizontalAlign.Center;
                oGridViewRow.Cells.Add(oTableCell);

                oGridViewRow.Font.Bold = true;
                oGridViewRow.BackColor = System.Drawing.Color.Aqua;
                grdProdData.Controls[0].Controls.AddAt(grdProdData.Rows.Count+1, oGridViewRow);
                //grdProdData.DataBind();
            }
            else
            {
                btnExport.Visible = false;
                grdProdData.DataSource = null;
                grdProdData.DataBind();
            }
        }
        else
        {
            btnExport.Visible = false;
            grdProdData.DataSource = null;
            grdProdData.DataBind();
        }
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:56,代码来源:SalesSummary.aspx.cs

示例11: txtBarcode_TextChanged

    private void txtBarcode_TextChanged(TextBox txtBarcode, GridViewRow gRow, string cmbMaterialName, string lblProductTypeName, string txtUnitName, string lblUnitName)
    {
        DropDownList cmbMaterial = (DropDownList)gRow.Cells[indexMATERIAL].FindControl(cmbMaterialName);
        Label lblProductType = (Label)gRow.Cells[indexPRODUCTTYPE].FindControl(lblProductTypeName);
        TextBox txtUnit = (TextBox)gRow.Cells[indexUNIT].FindControl(txtUnitName);
        Label lblUnit = (Label)gRow.Cells[indexUNIT].FindControl(lblUnitName);

        BomProductData data = FlowObj.GetProductData(0, txtBarcode.Text.Trim());
        SetProductDetail(data, gRow, txtBarcode, cmbMaterial, lblProductType, txtUnit, lblUnit);
    }
开发者ID:SoftSuite,项目名称:ABB,代码行数:10,代码来源:Bom.aspx.cs

示例12: ColorizeCell

 public static void ColorizeCell(GridViewRow row, int num)
 {
     if (row.Cells.Count > num)
     {
         TableCell cell = row.Cells[num];
         cell.ForeColor =
             (!string.IsNullOrEmpty(cell.Text) && cell.Text[0] == '-') ?
                                                             Color.Red : Color.Green;
     }
 }
开发者ID:ruslanu,项目名称:qlight,代码行数:10,代码来源:FormatUtils.cs

示例13: cmbMaterial_SelectedIndexChanged

    private void cmbMaterial_SelectedIndexChanged(DropDownList cmbMaterial, GridViewRow gRow, string txtBarcodeName, string lblProductTypeName, string txtUnitName, string lblUnitName)
    {
        TextBox txtBarcode = (TextBox)gRow.Cells[indexBARCODE].FindControl(txtBarcodeName);
        Label lblProductType = (Label)gRow.Cells[indexPRODUCTTYPE].FindControl(lblProductTypeName);
        TextBox txtUnit = (TextBox)gRow.Cells[indexUNIT].FindControl(txtUnitName);
        Label lblUnit = (Label)gRow.Cells[indexUNIT].FindControl(lblUnitName);

        BomProductData data = FlowObj.GetProductData(Convert.ToDouble(cmbMaterial.SelectedItem.Value), "");
        SetProductDetail(data, gRow, txtBarcode, cmbMaterial, lblProductType, txtUnit, lblUnit);
    }
开发者ID:SoftSuite,项目名称:ABB,代码行数:10,代码来源:Bom.aspx.cs

示例14: DrawHeader

    private void DrawHeader(object sender)
    {
        GridView grd = (GridView)sender;
        if (grd.Rows.Count > 0) return; //有数据,不要处理
        GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.EmptyDataRow, DataControlRowState.Normal);
        foreach (DataControlField field in grd.Columns)
        {
            TableCell cell = new TableCell();
            cell.Text = field.HeaderText;
            cell.Width = field.HeaderStyle.Width;
            cell.Height = field.HeaderStyle.Height;
            cell.ForeColor = field.HeaderStyle.ForeColor;
            cell.Font.Size = field.HeaderStyle.Font.Size;
            cell.Font.Bold = field.HeaderStyle.Font.Bold;
            cell.Font.Name = field.HeaderStyle.Font.Name;
            cell.Font.Strikeout = field.HeaderStyle.Font.Strikeout;
            cell.Font.Underline = field.HeaderStyle.Font.Underline;
            cell.BackColor = field.HeaderStyle.BackColor;
            cell.VerticalAlign = field.HeaderStyle.VerticalAlign;
            cell.HorizontalAlign = field.HeaderStyle.HorizontalAlign;
            //cell.CssClass = field.HeaderStyle.CssClass;
            cell.BorderColor = field.HeaderStyle.BorderColor;
            cell.BorderStyle = field.HeaderStyle.BorderStyle;
            cell.BorderWidth = field.HeaderStyle.BorderWidth;
            cell.Visible = field.Visible;
            row.Cells.Add(cell);
        }

        TableItemStyle headStyle = grd.HeaderStyle;
        TableItemStyle emptyStyle = grd.EmptyDataRowStyle;
        emptyStyle.Width = headStyle.Width;
        emptyStyle.Height = headStyle.Height;
        emptyStyle.ForeColor = headStyle.ForeColor;
        emptyStyle.Font.Size = headStyle.Font.Size;
        emptyStyle.Font.Bold = headStyle.Font.Bold;
        emptyStyle.Font.Name = headStyle.Font.Name;
        emptyStyle.Font.Strikeout = headStyle.Font.Strikeout;
        emptyStyle.Font.Underline = headStyle.Font.Underline;
        emptyStyle.BackColor = headStyle.BackColor;
        emptyStyle.VerticalAlign = headStyle.VerticalAlign;
        emptyStyle.HorizontalAlign = headStyle.HorizontalAlign;
        emptyStyle.CssClass = emptyStyle.CssClass;
        emptyStyle.BorderColor = headStyle.BorderColor;
        emptyStyle.BorderStyle = headStyle.BorderStyle;
        emptyStyle.BorderWidth = headStyle.BorderWidth;
        if (grd.Controls.Count == 0)
        {
            //grd.Page.Response.Write("<script language='javascript'>alert('必须在初始化表格类之前执行DataBind方法并设置EmptyDataText属性不为空!');</script>");
        }
        else
        {
            grd.Controls[0].Controls.Clear(); //删除没数据时的提示
            grd.Controls[0].Controls.AddAt(0, row);
        }
    }
开发者ID:qq5013,项目名称:JXNG,代码行数:55,代码来源:UGridView.cs

示例15: SplitTableHeader

 /// <summary>
 /// 重写表头
 /// </summary>
 /// <param name="targetHeader">目标表头</param>
 /// <param name="newHeaderNames">新表头</param>
 /// <remarks>
 /// 等级#级别#上期结存 件数,重量,比例#本期调入 收购调入 件数,重量,比例#本期发出 车间投料 件数,重量,
 /// 比例#本期发出 产品外销百分比 件数,重量,比例#平均值
 /// </remarks>
 public void SplitTableHeader(GridViewRow targetHeader, string newHeaderNames)
 {
     TableCellCollection tcl = targetHeader.Cells;//获得表头元素的实例
     tcl.Clear();//清除元素
     int row = GetRowCount(newHeaderNames);
     int col = GetColCount(newHeaderNames);
     string[,] nameList = ConvertList(newHeaderNames, row, col);
     int RowSpan = 0;
     int ColSpan = 0;
     for (int k = 0; k < row; k++)
     {
         string LastFName = "";
         for (int i = 0; i < col; i++)
         {
             if (LastFName == nameList[i, k] && k != row - 1)
             {
                 LastFName = nameList[i, k];
                 continue;
             }
             else
             {
                 LastFName = nameList[i, k];
             }
             int bFlag = IsVisible(nameList, k, i, LastFName);
             switch (bFlag)
             {
                 case 0:
                     break;
                 case 1:
                     RowSpan = GetSpanRowCount(nameList, row, k, i);
                     ColSpan = GetSpanColCount(nameList, row, col, k, i);
                     tcl.Add(new TableHeaderCell());//添加表头控件
                     tcl[tcl.Count - 1].RowSpan = RowSpan;
                     tcl[tcl.Count - 1].ColumnSpan = ColSpan;
                     tcl[tcl.Count - 1].HorizontalAlign = HorizontalAlign.Center;
                     tcl[tcl.Count - 1].Text = LastFName;
                     break;
                 case -1:
                     string[] EndColName = LastFName.Split(new char[] { ',' });
                     foreach (string eName in EndColName)
                     {
                         tcl.Add(new TableHeaderCell());//添加表头控件
                         tcl[tcl.Count - 1].HorizontalAlign = HorizontalAlign.Center;
                         tcl[tcl.Count - 1].Text = eName;
                     }
                     break;
             }
         }
         if (k != row - 1)
         {//不是起始行,加入新行标签
             tcl[tcl.Count - 1].Text = tcl[tcl.Count - 1].Text + "</th>\n</tr>\n<tr>\n";
         }
     }
 }
开发者ID:clchappy,项目名称:b1031,代码行数:63,代码来源:DynamicTHeaderHepler.cs


注:本文中的GridViewRow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。