• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# WebControls.GridViewRow类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: InitializePager

 protected override void InitializePager(GridViewRow row, int columnSpan, PagedDataSource pagedDataSource)
 {
     if (UseCustomPager)
         CreateCustomPager(row, columnSpan, pagedDataSource);
     else
         base.InitializePager(row, columnSpan, pagedDataSource);
 }
开发者ID:aptivasoft,项目名称:Adio,代码行数:7,代码来源:GridViewWithPager.cs


示例2: SummaryReportGridView_OnDataBound

        protected void SummaryReportGridView_OnDataBound(object sender, EventArgs e)
        {
            GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
            TableHeaderCell cell = new TableHeaderCell();
            cell.Text = "";
            cell.ColumnSpan = 2;
            row.Controls.Add(cell);

            row.BackColor = ColorTranslator.FromHtml("#9e1b34");
            row.ForeColor = ColorTranslator.FromHtml("White");

            SummaryReportGridView.Rows[7].Style.Add(HtmlTextWriterStyle.FontWeight, "Bold");

            row.HorizontalAlign = HorizontalAlign.Center;

            foreach (GridViewRow row2 in SummaryReportGridView.Rows)
            {
                LinkButton lb = (LinkButton)row2.Cells[0].Controls[0];
                lb.ForeColor = ColorTranslator.FromHtml("#0000EE");

            }

            LinkButton lb2 = (LinkButton)SummaryReportGridView.Rows[7].Cells[0].Controls[0];
            lb2.Enabled = false;
            lb2.ControlStyle.Font.Underline = false;
            lb2.ForeColor = ColorTranslator.FromHtml("Black");
            lb2.ControlStyle.Font.Bold = true;
        }
开发者ID:redtchits,项目名称:RCM,代码行数:28,代码来源:MakeProjections.aspx.cs


示例3: SetPagerButtonStates

        /// <summary>
        /// Sets the pager button states.
        /// </summary>
        /// <param name="gridView">The grid view.</param>
        /// <param name="gvPagerRow">The gv pager row.</param>
        /// <param name="page">The page.</param>
        public static void SetPagerButtonStates(GridView gridView, GridViewRow gvPagerRow, Page page)
        {
            int pageIndex = gridView.PageIndex;
            int pageCount = gridView.PageCount;

            ImageButton btnFirst = (ImageButton)gvPagerRow.FindControl("btnFirst");
            ImageButton btnPrevious = (ImageButton)gvPagerRow.FindControl("btnPrevious");
            ImageButton btnNext = (ImageButton)gvPagerRow.FindControl("btnNext");
            ImageButton btnLast = (ImageButton)gvPagerRow.FindControl("btnLast");

            btnFirst.Enabled = btnPrevious.Enabled = (pageIndex != 0);
            btnNext.Enabled = btnLast.Enabled = (pageIndex < (pageCount - 1));

            DropDownList ddlPageSelector = (DropDownList)gvPagerRow.FindControl("ddlPages");
            ddlPageSelector.Items.Clear();
            for (int i = 1; i <= gridView.PageCount; i++)
            {
                ddlPageSelector.Items.Add(i.ToString());
            }

            ddlPageSelector.SelectedIndex = pageIndex;

            Label lblPageCount = (Label)gvPagerRow.FindControl("lblPageCount");
            lblPageCount.Text = pageCount.ToString();

            //ddlPageSelector.SelectedIndexChanged += delegate
            //{
            //    gridView.PageIndex = ddlPageSelector.SelectedIndex;
            //    gridView.DataBind();
            //};
        }
开发者ID:JackyW83,项目名称:Test,代码行数:37,代码来源:PresentationUtils.cs


示例4: SetSortImageStates

        /// <summary>
        /// Sets the sort image states.
        /// </summary>
        /// <param name="gridView">The grid view.</param>
        /// <param name="row">The row.</param>
        /// <param name="sortField">The sort field.</param>
        /// <param name="sortAscending">if set to <c>true</c> [sort ascending].</param>
        public static void SetSortImageStates(GridView gridView, GridViewRow row,int columnStartIndex, string sortField, bool sortAscending)
        {
            for (int i = columnStartIndex; i < row.Cells.Count; i++)
            {
                TableCell tc = row.Cells[i];
                if (tc.HasControls())
                {
                    // search for the header link
                    LinkButton lnk = (LinkButton)tc.Controls[0];
                    if (lnk != null)
                    {
                        // initialize a new image
                        System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
                        // setting the dynamically URL of the image
                        img.ImageUrl = "~/images/" + (sortAscending ? "bullet_arrow_up" : "bullet_arrow_down") + ".png";
                        img.CssClass = "icon";
                        // checking if the header link is the user's choice
                        if (sortField == lnk.CommandArgument)
                        {
                            // adding a space and the image to the header link
                            //tc.Controls.Add(new LiteralControl(" "));
                            tc.Controls.Add(img);
                        }

                    }
                }
            }
        }
开发者ID:JackyW83,项目名称:Test,代码行数:35,代码来源:PresentationUtils.cs


示例5: OnInit

 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     Grid = Parent.Parent.Parent.Parent as GridView;
     Row = Parent.Parent as GridViewRow;
     Grid.DataBound += new EventHandler(Grid_DataBound);
 }
开发者ID:rossspoon,项目名称:bvcms,代码行数:7,代码来源:GridPager.ascx.cs


示例6: CreateChildControls

        protected override int CreateChildControls(System.Collections.IEnumerable dataSource, bool dataBinding)
        {
            int numRows = base.CreateChildControls(dataSource, dataBinding);

            //no data rows created, create empty table if enabled
            if (numRows == 0 && ShowEmptyTable)
            {
                //create table
                Table table = new Table();
                table.ID = this.ID;

                //create a new header row
                GridViewRow row = base.CreateRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal);

                //convert the exisiting columns into an array and initialize
                DataControlField[] fields = new DataControlField[this.Columns.Count];
                this.Columns.CopyTo(fields, 0);
                this.InitializeRow(row, fields);
                table.Rows.Add(row);

                //create the empty row
                row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
                TableCell cell = new TableCell();
                cell.ColumnSpan = this.Columns.Count;
                cell.Width = Unit.Percentage(100);
                cell.Controls.Add(new LiteralControl(EmptyTableRowText));
                row.Cells.Add(cell);
                table.Rows.Add(row);

                this.Controls.Add(table);
            }

            return numRows;
        }
开发者ID:thaond,项目名称:vdms-sym-project,代码行数:34,代码来源:EmptyGridView.cs


示例7: SetSortImageStates

        /// <summary>
        /// Sets the sort image states.
        /// </summary>
        /// <param name="gridView">The grid view.</param>
        /// <param name="row">The row.</param>
        /// <param name="columnStartIndex"> </param>
        /// <param name="sortField">The sort field.</param>
        /// <param name="sortAscending">if set to <c>true</c> [sort ascending].</param>
        public static void SetSortImageStates(GridView gridView, GridViewRow row,int columnStartIndex, string sortField, bool sortAscending)
        {
            for (var i = columnStartIndex; i < row.Cells.Count; i++)
            {
                var tc = row.Cells[i];
                if (!tc.HasControls()) continue;

                // search for the header link  
                var lnk = tc.Controls[0] as LinkButton;
                if (lnk == null) continue;

                // initialize a new image
                var img = new Image
                {
                    ImageUrl = string.Format("~/images/{0}.png", (sortAscending ? "bullet_arrow_up" : "bullet_arrow_down")),
                    CssClass = "icon"
                };

                // setting the dynamically URL of the image
                // checking if the header link is the user's choice
                if (sortField == lnk.CommandArgument)
                {
                    // adding a space and the image to the header link
                    //tc.Controls.Add(new LiteralControl(" "));
                    tc.Controls.Add(img);
                }
            }
        }
开发者ID:ChuckLafferty,项目名称:bugnet,代码行数:36,代码来源:PresentationUtils.cs


示例8: GetGridViewInt

        public static int GetGridViewInt(GridViewRow gvr, int columnIndex)
        {
            int returnValue = -1;

            returnValue = int.Parse(gvr.Cells[columnIndex].Text);

            return returnValue;
        }
开发者ID:jtm61489,项目名称:skypath,代码行数:8,代码来源:GridViewHelper.cs


示例9: gvLoaiHangMucDetails_RowCreated

        protected void gvLoaiHangMucDetails_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                //Headerow number
                GridViewRow HeaderRowNumber = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);

                TableCell HeaderCellNumber = new TableCell();
                HeaderCellNumber.Text = "1";
                HeaderRowNumber.Cells.Add(HeaderCellNumber);

                HeaderCellNumber = new TableCell();
                HeaderCellNumber.Text = "2";
                HeaderRowNumber.Cells.Add(HeaderCellNumber);

                HeaderCellNumber = new TableCell();
                HeaderCellNumber.Text = "3";
                HeaderRowNumber.Cells.Add(HeaderCellNumber);

                HeaderCellNumber = new TableCell();
                HeaderCellNumber.Text = "4";
                HeaderRowNumber.Cells.Add(HeaderCellNumber);

                HeaderCellNumber = new TableCell();
                HeaderCellNumber.Text = "5";
                HeaderRowNumber.Cells.Add(HeaderCellNumber);

                gvLoaiHangMucDetails.Controls[0].Controls.AddAt(0, HeaderRowNumber);

                GridViewRow HeaderRowTitle = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);

                TableCell HeaderCellTitle = new TableCell();
                HeaderCellTitle.Text = "No. <br/>(stt)";
                HeaderCellTitle.Width = 30;
                HeaderRowTitle.Cells.Add(HeaderCellTitle);

                HeaderCellTitle = new TableCell();
                HeaderCellTitle.Text = "DESCRIPTION<br/> (Diễn giải)";
                HeaderRowTitle.Cells.Add(HeaderCellTitle);

                HeaderCellTitle = new TableCell();
                HeaderCellTitle.Text = "Q.TY<br/>(Số lượng)";
                HeaderRowTitle.Cells.Add(HeaderCellTitle);

                HeaderCellTitle = new TableCell();
                HeaderCellTitle.Text = "UNIT.<br/>(ĐVT)";
                HeaderRowTitle.Cells.Add(HeaderCellTitle);

                HeaderCellTitle = new TableCell();
                HeaderCellTitle.Text = "L.A's Remark<br/>(GDV ghi chú)";
                HeaderRowTitle.Cells.Add(HeaderCellTitle);

                gvLoaiHangMucDetails.Controls[0].Controls.AddAt(1, HeaderRowTitle);

                HeaderRowTitle.Attributes.Add("class", "header");
                HeaderRowNumber.Attributes.Add("class", "header_number");
            }
        }
开发者ID:baotiit,项目名称:savvyplatform,代码行数:58,代码来源:reportClaim.aspx.cs


示例10: CreateCustomPager

        protected virtual void CreateCustomPager(GridViewRow row, int columnSpan, PagedDataSource pagedDataSource)
        {
            int pageCount = pagedDataSource.PageCount;
            int pageIndex = pagedDataSource.CurrentPageIndex + 1;
            int pageButtonCount = PagerSettings.PageButtonCount;

            TableCell cell = new TableCell();
            row.Cells.Add(cell);
            if (columnSpan > 1) cell.ColumnSpan = columnSpan;

            if (pageCount > 1)
            {
                HtmlGenericControl pager = new HtmlGenericControl("div");
                pager.Attributes["class"] = "pagination";
                cell.Controls.Add(pager);

                int min = pageIndex - pageButtonCount;
                int max = pageIndex + pageButtonCount;

                if (max > pageCount)
                    min -= max - pageCount;
                else if (min < 1)
                    max += 1 - min;

                // Create "previous" button
                Control page = pageIndex > 1
                                ? BuildLinkButton(pageIndex - 2, PagerSettings.PreviousPageText, "Page", "Prev")
                                : BuildSpan(PagerSettings.PreviousPageText, "disabled");
                pager.Controls.Add(page);

                // Create page buttons
                bool needDiv = false;
                for (int i = 1; i <= pageCount; i++)
                {
                    if (i <= 2 || i > pageCount - 2 || (min <= i && i <= max))
                    {
                        string text = i.ToString(NumberFormatInfo.InvariantInfo);
                        page = i == pageIndex
                                ? BuildSpan(text, "current")
                                : BuildLinkButton(i - 1, text, "Page", text);
                        pager.Controls.Add(page);
                        needDiv = true;
                    }
                    else if (needDiv)
                    {
                        page = BuildSpan("&hellip;", null);
                        pager.Controls.Add(page);
                        needDiv = false;
                    }
                }

                // Create "next" button
                page = pageIndex < pageCount
                        ? BuildLinkButton(pageIndex, PagerSettings.NextPageText, "Page", "Next")
                        : BuildSpan(PagerSettings.NextPageText, "disabled");
                pager.Controls.Add(page);
            }
        }
开发者ID:aptivasoft,项目名称:Adio,代码行数:58,代码来源:GridViewWithPager.cs


示例11: ExcelMoreBook

 /**/
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dt">List(数据源)</param>
 /// <param name="title">List(Excel显示标题)</param>
 public ExcelMoreBook(List<DataTable> dt, List<string> title)
 {
     Page page = (Page)HttpContext.Current.Handler;
     if (dt.Count == 0)
     {
         throw new Exception("数据源为空");
     }
     _dataTable = dt;
     _title = title;
     _page = page;
 }
 /**/
 /// <summary>
 /// 以GridView的Head为标题
 /// </summary>
 /// <param name="row">GridView表头行对象</param>
 public void SetColumnNameFromGridViewHeadRow(GridViewRow row)
 {
     ExcelColumnCollection excelcols = new ExcelColumnCollection();
     _columnNamesCollection.Add(excelcols);
     foreach (TableCell cell in row.Cells)
     {
         excelcols.Add(new ExcelColumn(cell.Text));
     }
 }
开发者ID:joyhen,项目名称:mywork,代码行数:31,代码来源:ExcelMoreBook.cs


示例12: OnRowCreated

 protected override void OnRowCreated(GridViewRowEventArgs e)
 {
     base.OnRowCreated(e);
     if (DesignMode)
         return;
     //Get a handle for the pager row
     if (e.Row.RowType == DataControlRowType.Pager)
         PagerRow = e.Row;
 }
开发者ID:nick117,项目名称:ASP.NET.131,代码行数:9,代码来源:NestableGridView.cs


示例13: GridViewRow_DefaultProperty

		public void GridViewRow_DefaultProperty ()
		{
			GridViewRow row = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Normal);
			Assert.AreEqual (null, row.DataItem, "DataItem");
			Assert.AreEqual (0, row.DataItemIndex, "DataItemIndex"); //This value assigned into constractor
			Assert.AreEqual (0, row.RowIndex, "RowIndex");		 //This value assigned into constractor
			Assert.AreEqual (DataControlRowType.DataRow, row.RowType, "RowType");   //This value assigned into constractor
			Assert.AreEqual (DataControlRowState.Normal, row.RowState, "RowState"); //This value assigned into constractor
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:GridViewRowTest.cs


示例14: GetCellValue

 public static String GetCellValue(GridViewRow r,String col)
 {
     foreach (DataControlFieldCell cell in r.Cells)
     {
         if (cell.ContainingField is BoundField)
             if (((BoundField)cell.ContainingField).DataField.Equals(col))
                 return HttpUtility.HtmlDecode(cell.Text);
     }
     return "";
 }
开发者ID:D8CNPM,项目名称:ASP.NET,代码行数:10,代码来源:DB.cs


示例15: GetExportValue

        /// <summary>
        /// Gets the value that should be exported to Excel
        /// </summary>
        /// <param name="row">The row.</param>
        /// <returns></returns>
        public virtual object GetExportValue( GridViewRow row )
        {
            if ( row.DataItem is System.Data.DataRowView )
            {
                var dataRow = ( (System.Data.DataRowView)row.DataItem ).Row;
                return dataRow[this.DataField];
            }

            return row.DataItem.GetPropertyValue( this.DataField );
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:15,代码来源:RockBoundField.cs


示例16: gvDSincome_RowCreated

        protected void gvDSincome_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                GridViewRow HeaderRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);

                TableCell HeaderCell = new TableCell();
                HeaderCell.Text = "No.";
                HeaderCell.Width = 30;
                HeaderRow.Cells.Add(HeaderCell);

                HeaderCell = new TableCell();
                HeaderCell.Text = "Update Date";
                HeaderRow.Cells.Add(HeaderCell);
                HeaderCell.Width = 150;

                HeaderCell = new TableCell();
                HeaderCell.Text = "Date";
                HeaderRow.Cells.Add(HeaderCell);
                HeaderCell.Width = 80;

                HeaderCell = new TableCell();
                HeaderCell.Text = "Description";
                HeaderRow.Cells.Add(HeaderCell);
                HeaderCell.Width = 300;

                HeaderCell = new TableCell();
                HeaderCell.Text = "Time-spent";
                HeaderRow.Cells.Add(HeaderCell);
                HeaderCell.Width = 50;
                HeaderCell = new TableCell();
                HeaderCell.Text = "Rate";
                HeaderRow.Cells.Add(HeaderCell);
                HeaderCell.Width = 100;

                HeaderCell = new TableCell();
                HeaderCell.Text = "Cyber Income";
                HeaderRow.Cells.Add(HeaderCell);
                HeaderCell.Width = 150;

                HeaderCell = new TableCell();
                HeaderCell.Text = "Real Income";
                HeaderRow.Cells.Add(HeaderCell);
                HeaderCell.Width = 100;

                HeaderCell = new TableCell();
                HeaderCell.Text = "Remark";
                HeaderRow.Cells.Add(HeaderCell);
                HeaderCell.Width = 80;

                gvDSincome.Controls[0].Controls.AddAt(0, HeaderRow);
                HeaderRow.Attributes.Add("class", "header nodrop nodrag");
                //HeaderRow2.Attributes.Add("class", "header nodrop nodrag");
            }
        }
开发者ID:baotiit,项目名称:savvyplatform,代码行数:55,代码来源:detailincome.aspx.cs


示例17: GetText

 public static string GetText(GridViewRow row, string fieldName)
 {
     GridView grd = row.NamingContainer as GridView;
     if (grd != null)
     {
         int index = GetIndex(grd, fieldName);
         if (index != -1)
             return row.Cells[index].Text;
     }
     return "";
 }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:11,代码来源:GridViewBoundFieldHelper.cs


示例18: SetUnreadItemBold

		/// <summary>
		/// 设置未读条目样式
		/// </summary>
		/// <param name="row"></param>
		internal static void SetUnreadItemBold(GridViewRow row)
		{
			//由于ORMMapping入库时会把NULL或DataTime.MinValue存成NULL,如果直接从库取值再赋值,会把READ_TIME置成1900-01-01 00:00:00.000
			//为了防止其他意外情况发生,这里再加一个1900年的判断
			//沈峥说不用,这个责任该归到写的人身上,于是去掉了--080516
			//if (((UserTask)row.DataItem).ReadTime < new DateTime(1949, 10, 1, 0, 0, 0))
			if (((UserTask)row.DataItem).ReadTime == DateTime.MinValue)
			{
				row.Style["font-weight"] = "bold";
			}
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:15,代码来源:GridCommon.cs


示例19: GetValues

        public static IOrderedDictionary GetValues(GridViewRow row)
        {
            IOrderedDictionary values = new OrderedDictionary();
            foreach (DataControlFieldCell cell in row.Cells.Cast<DataControlFieldCell>().Where(cell => cell.Visible))
            {
                // Extract values from the cell.
                cell.ContainingField.ExtractValuesFromCell(values, cell, row.RowState, true);
            }

            return values;
        }
开发者ID:djdino56,项目名称:SE2_Ontwikkelopdracht,代码行数:11,代码来源:Scart.aspx.cs


示例20: GetValue

 public object GetValue(GridViewRow row)
 {
     foreach (TableCell cell in row.Cells)
     {
         if (cell.Attributes["colname"] != null && cell.Attributes["colname"] == this.DataField)
         {
             return this.GetValue(cell.FindControl(this.ControlID));
         }
     }
     return null;
 }
开发者ID:vahtel65,项目名称:Aspect_loc,代码行数:11,代码来源:EditableProductGridField.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WebControls.GridViewRowEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# WebControls.GridViewPageEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap