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

C# WebControls.GridView类代码示例

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

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



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

示例1: 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


示例2: Add

        public static long Add(string book, DateTime valueDate, string partyCode, int priceTypeId, GridView grid, string referenceNumber, string statementReference)
        {
            MixERP.Net.Common.Models.Transactions.StockMasterModel stockMaster = new MixERP.Net.Common.Models.Transactions.StockMasterModel();
            Collection<MixERP.Net.Common.Models.Transactions.StockMasterDetailModel> details = new Collection<MixERP.Net.Common.Models.Transactions.StockMasterDetailModel>();
            long nonGlStockMasterId = 0;

            stockMaster.PartyCode = partyCode;
            stockMaster.PriceTypeId = priceTypeId;

            if(grid != null)
            {
                if(grid.Rows.Count > 0)
                {
                    foreach(GridViewRow row in grid.Rows)
                    {
                        MixERP.Net.Common.Models.Transactions.StockMasterDetailModel detail = new MixERP.Net.Common.Models.Transactions.StockMasterDetailModel();

                        detail.ItemCode = row.Cells[0].Text;
                        detail.Quantity = MixERP.Net.Common.Conversion.TryCastInteger(row.Cells[2].Text);
                        detail.UnitName = row.Cells[3].Text;
                        detail.Price = MixERP.Net.Common.Conversion.TryCastDecimal(row.Cells[4].Text);
                        detail.Discount = MixERP.Net.Common.Conversion.TryCastDecimal(row.Cells[6].Text);
                        detail.TaxRate = MixERP.Net.Common.Conversion.TryCastDecimal(row.Cells[8].Text);
                        detail.Tax = MixERP.Net.Common.Conversion.TryCastDecimal(row.Cells[9].Text);

                        details.Add(detail);
                    }
                }
            }

            nonGlStockMasterId = MixERP.Net.DatabaseLayer.Transactions.NonGLStockTransaction.Add(book, valueDate, MixERP.Net.BusinessLayer.Helpers.SessionHelper.OfficeId(), MixERP.Net.BusinessLayer.Helpers.SessionHelper.UserId(), MixERP.Net.BusinessLayer.Helpers.SessionHelper.LogOnId(), referenceNumber, statementReference, stockMaster, details);
            return nonGlStockMasterId;
        }
开发者ID:ravikumr070,项目名称:mixerp,代码行数:33,代码来源:NonGlStockTransaction.cs


示例3: ChecklistRulesInformationEmptyFix

        protected void ChecklistRulesInformationEmptyFix(GridView grdChecklistRulesInformation)
        {
            if (grdChecklistRulesInformation.Rows.Count == 0)
            {
                DateTime lastService = new DateTime();
                DateTime nextDue = new DateTime();
                UnitInformationTDS.ChecklistDetailsDataTable dt = new UnitInformationTDS.ChecklistDetailsDataTable();
                dt.AddChecklistDetailsRow(0, "", "", lastService, nextDue, false, "Unknown", false);
                Session["unitsChecklistRulesEditDummy"] = dt;

                grdChecklistRulesInformation.DataBind();
            }

            // normally executes at all postbacks
            if (grdChecklistRulesInformation.Rows.Count == 1)
            {
                UnitInformationTDS.ChecklistDetailsDataTable dt = (UnitInformationTDS.ChecklistDetailsDataTable)Session["unitsChecklistRulesEditDummy"];
                if (dt != null)
                {
                    // hide row
                    grdChecklistRulesInformation.Rows[0].Visible = false;
                    grdChecklistRulesInformation.Rows[0].Controls.Clear();
                }
            }
        }
开发者ID:NosDeployer,项目名称:TestBranching,代码行数:25,代码来源:units_checklist_rules.aspx.cs


示例4: HandleService

        /// <summary>
        /// Sorts the records in the specified <see cref="GridView"/>.
        /// </summary>
        /// <param name="action">The 'Sorting' <see cref="GridAction"/> to perform.</param>
        /// <param name="view">The <see cref="GridView"/> to sort.</param>
        /// <param name="p">The parameters used for sorting.</param>
        public void HandleService(GridAction action, GridView view, params object[] p)
        {
            if (view == null) return;
            if (!view.AllowSorting) return;
            if (action != GridAction.Sorting) return;

            // Handle sorting
            GridViewSortEventArgs args = p[0] as GridViewSortEventArgs;
            if (args == null) return;

            if (args.SortExpression == LastExpression)
            {
                SortAscending = !SortAscending;
            }
            else
            {
                SortAscending = true;
                LastExpression = args.SortExpression;
            }

            args.SortDirection = SortDirection;

            if (view.DataSource is IDomainCollection)
            {
                IDomainCollection col = (IDomainCollection)view.DataSource;

                col.Sort(args.SortExpression, (args.SortDirection == SortDirection.Ascending) ? SortOrder.Ascending : SortOrder.Descending);

                view.DataSource = col;
            }

            view.DataBind();
        }
开发者ID:erwinbovendeur,项目名称:ADF,代码行数:39,代码来源:BusinessGridViewSorter.cs


示例5: Show

 internal static void Show(GridView ListTests, string UserName)
 {
     SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString);
     string str = "select d.Discipline_name, c.categories_name, t.name, ct.points, ct.dateComplite " +
         " from Complite_test as ct inner join test as t on ct.test_id = t.test_id " +
         " inner join Categories as c on c.cat_id = t.cat_id " +
         " inner join discipline as d on d.discipline_id = c.discipline_id " +
         " inner join users as u on u.user_id = ct.user_id where u.login = @login";
     SqlCommand cmd = new SqlCommand(str, con);
     cmd.Parameters.AddWithValue("login", UserName);
     try
     {
         con.Open();
         SqlDataSource ds = new SqlDataSource(con.ConnectionString, str);
         Parameter p = new Parameter("login", System.Data.DbType.String, UserName);
         ds.SelectParameters.Add(p);
         ListTests.DataSource = ds;
         ListTests.DataBind();
     }
     catch (Exception)
     {
         throw new ApplicationException("Не удается отобразить список завершенных тестов");
     }
     finally {
         con.Close();
     }
 }
开发者ID:juchok,项目名称:testKnowlige,代码行数:27,代码来源:testComplite.aspx.cs


示例6: ViewCards

        public ActionResult ViewCards(CardInput cardInput)
        {
            if (ModelState.IsValid)
            {
                CardGenerator cardGenerator = new CardGenerator(cardInput.GeneratingDate, cardInput.NumberOfCards);
                List<Card> CardList = cardGenerator.GetCardsList();
                CardDAO cardDAO = new CardDAO();
                if (!cardDAO.ISExsistCardDate(CardList[0].CardNumber))
                {
                    GridView gridView = new GridView();
                    gridView.DataSource = CardList;
                    gridView.DataBind();
                    Session["CardsListEXCEL"] = gridView;
                    Session["CardsList"] = CardList;

                    return View(CardList);
                }
                else
                {
                    ModelState.AddModelError("", "You have already generated cards on this date, so choose aonther date. ");
                    return View("ShowCards");

                }

            }
            else
            {
                ModelState.AddModelError("", "Card List is not available");
                return View("ShowCards");
            }
        }
开发者ID:MisuBeImp,项目名称:DhakaUniversityCyberCenterAdministratorSite,代码行数:31,代码来源:CardController.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="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


示例8: ExportClientsListToExcel

        public void ExportClientsListToExcel()
        {
            var grid = new System.Web.UI.WebControls.GridView();
            string[] ClientsList={"mike","jonh","vladimit"};
            grid.DataSource = /*from d in dbContext.diners
                              where d.user_diners.All(m => m.user_id == userID) && d.active == true */
                              from d in ClientsList
                              select new
                              {
                                  FirstName = d
                              };

            grid.DataBind();

            Response.ClearContent();
            Response.AddHeader("content-disposition", "attachment; filename=Exported_Diners.xls");
            Response.ContentType = "application/excel";
            StringWriter sw = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);

            grid.RenderControl(htw);

            Response.Write(sw.ToString());

            Response.End();
        }
开发者ID:poledustaren,项目名称:FindRussianWords,代码行数:26,代码来源:ExcelController.cs


示例9: UpdateAdminRoomGrid

        public static void UpdateAdminRoomGrid(GridView gv)
        {
            if (superRoomList.Count == 0)
            {
                return;
            }

            if (gv.Rows.Count != superRoomList.Count)
            {
                return;
            }

            for (var i = 0; i < superRoomList.Count; i++)
            {
                var r = superRoomList[i];
                gv.Rows[i].Cells[0].Text = r.Name;
                gv.Rows[i].Cells[1].Text = r.MaxParticipants.ToString();

                var s = string.Empty;
                int j;
                for (j = 0; j < r.Inventories.Count() - 1; j++)
                {
                    s += r.Inventories[j].ProductName + ", ";
                }

                if (r.Inventories.Count() != 0)
                {
                    s += r.Inventories[j].ProductName;
                }

                gv.Rows[i].Cells[2].Text = s;
            }
        }
开发者ID:esfdk,项目名称:itubs,代码行数:33,代码来源:AdminRoomListViewModel.cs


示例10: GroupCol

 /// <summary>
 /// 合并GridView中某列相同信息的行(单元格)
 /// </summary>
 /// <param name="GridView1"></param>
 /// <param name="cellNum"></param>
 public static void GroupCol(GridView gridView, int cols)
 {
     if (gridView.Rows.Count < 1 || cols > gridView.Rows[0].Cells.Count - 1)
         {
             return;
         }
         TableCell oldTc = gridView.Rows[0].Cells[cols];
         for (int i = 1; i < gridView.Rows.Count; i++)
         {
             TableCell tc = gridView.Rows[i].Cells[cols];
             if (oldTc.Text == tc.Text)
             {
                 tc.Visible = false;
                 if (oldTc.RowSpan == 0)
                 {
                     oldTc.RowSpan = 1;
                 }
                 oldTc.RowSpan++;
                 oldTc.VerticalAlign = VerticalAlign.Middle;
             }
             else
             {
                 oldTc = tc;
             }
         }
 }
开发者ID:huaminglee,项目名称:Cooperative--Office-Automation-System,代码行数:31,代码来源:GridviewRowsCell.cs


示例11: btnDownload_Click

        protected void btnDownload_Click(object sender, ImageClickEventArgs e)
        {
            Response.Clear();

            Response.AddHeader("content-disposition", "attachment; filename=Baogia.xls");

            Response.Charset = "";

            Response.ContentType = "application/vnd.xls";

            System.IO.StringWriter stringWrite = new System.IO.StringWriter();

            System.Web.UI.HtmlTextWriter htmlWrite =
            new HtmlTextWriter(stringWrite);

            DataSet dts = new DataSet();
            SqlDataAdapter adt = new SqlDataAdapter();
            SqlCommand comm = new SqlCommand("Export_to_Excel", objConn.SqlConn());
            comm.CommandType = CommandType.StoredProcedure;
            comm.Connection.Open();
            adt.SelectCommand = comm;
            adt.Fill(dts);

            GridView g = new GridView();
            g.DataSource = dts;
            g.DataBind();

            g.RenderControl(htmlWrite);

            Response.Write(stringWrite.ToString());

            Response.End();
        }
开发者ID:phamtuanchip,项目名称:tmdt,代码行数:33,代码来源:Right.ascx.cs


示例12: BindItemData

 private void BindItemData(GridView itemsview, int TopicID)
 {
     DataTable table = (DataTable) this.ViewState["dtcount"];
     DataRow[] rowArray = table.Select("TopicID=" + TopicID);
     object obj2 = table.Compute("sum(SubmitNum)", "TopicID=" + TopicID);
     int num = 0;
     if (obj2.ToString() != "")
     {
         num = int.Parse(obj2.ToString());
     }
     ArrayList list = new ArrayList();
     for (int i = 0; i < rowArray.Length; i++)
     {
         string str = rowArray[i]["Name"].ToString();
         int num3 = int.Parse(rowArray[i]["SubmitNum"].ToString());
         OptionList list2 = new OptionList {
             name = str,
             count = num3.ToString(),
             totalcount = num.ToString()
         };
         list.Add(list2);
     }
     itemsview.DataSource = list;
     itemsview.DataBind();
 }
开发者ID:huaminglee,项目名称:myyyyshop,代码行数:25,代码来源:ShowCount.cs


示例13: 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


示例14: GroupRows

 /// <summary> 
 /// 合并GridView中某列相同信息的行(单元格) 
 /// </summary> 
 /// <param name="GridView1">GridView</param> 
 /// <param name="cellNum">第几列</param>
 public static void GroupRows(GridView GridView1, int cellNum)
 {
     int i = 0, rowSpanNum = 1;
     while (i < GridView1.Rows.Count - 1)
     {
         GridViewRow gvr = GridView1.Rows[i];
         for (++i; i < GridView1.Rows.Count; i++)
         {
             GridViewRow gvrNext = GridView1.Rows[i];
             if (gvr.Cells[cellNum].Text == gvrNext.Cells[cellNum].Text)
             {
                 gvrNext.Cells[cellNum].Visible = false;
                 rowSpanNum++;
             }
             else
             {
                 gvr.Cells[cellNum].RowSpan = rowSpanNum;
                 rowSpanNum = 1;
                 break;
             }
             if (i == GridView1.Rows.Count - 1)
             {
                 gvr.Cells[cellNum].RowSpan = rowSpanNum;
             }
         }
     }
 }
开发者ID:JackSunny1980,项目名称:SISKPI,代码行数:32,代码来源:KPI_ZJScorePlant.aspx.cs


示例15: AddRepairsNewEmptyFix

        protected void AddRepairsNewEmptyFix(GridView grdView)
        {
            if (grdRepairs.Rows.Count == 0)
            {
                int companyId = Int32.Parse(hdfCompanyId.Value);
                PointRepairsTDS.RepairDetailsDataTable dt = new PointRepairsTDS.RepairDetailsDataTable();
                dt.AddRepairDetailsRow(-1, "PL-A", "Temp", "", DateTime.Now, "", "", 0, "", "", "", "", DateTime.Now, "", "", DateTime.Now, "", false, false, "", false, companyId, false, "", "", "", DateTime.Now);
                Session["pointRepairsRepairsTempDummy"] = dt;
                SetFilter("Type='Temp' AND Deleted = 0");
                grdRepairs.DataBind();
            }

            // normally executes at all postbacks
            if (grdRepairs.Rows.Count == 1)
            {
                PointRepairsTDS.RepairDetailsDataTable dt = (PointRepairsTDS.RepairDetailsDataTable)Session["pointRepairsRepairsTempDummy"];
                if (dt != null)
                {
                    grdRepairs.Rows[0].Visible = false;
                    grdRepairs.Rows[0].Controls.Clear();

                    Session.Remove("pointRepairsRepairsTempDummy");
                }
            }
        }
开发者ID:NosDeployer,项目名称:TestBranching,代码行数:25,代码来源:pr_summary.aspx.cs


示例16: ExportToExcel

        public void ExportToExcel(DataTable dataTable, HttpResponse response)
        {
            // Create a dummy GridView
            GridView GridView1 = new GridView();
            GridView1.AllowPaging = false;
            GridView1.DataSource = dataTable;
            GridView1.DataBind();
            response.Clear();
            response.Buffer = true;
            response.AddHeader("content-disposition", "attachment;filename=DataTable.xls");
            response.Charset = "";
            response.ContentType = "application/vnd.ms-excel";
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            for (int i = 0; (i
                        <= (GridView1.Rows.Count - 1)); i++)
            {
                // Apply text style to each Row
                GridView1.Rows[i].Attributes.Add("class", "textmode");
            }

            GridView1.RenderControl(hw);
            // style to format numbers to string
            string style = "<style> .textmode{mso-number-format:\\@;}</style>";
            response.Write(style);
            response.Output.Write(sw.ToString());
            response.Flush();
            response.End();
        }
开发者ID:rudolfcruz,项目名称:Reports,代码行数:29,代码来源:GenReportes.cs


示例17: Add

        public static long Add(DateTime valueDate, string referenceNumber, int costCenterId, GridView grid)
        {
            Collection<MixERP.Net.Common.Models.Transactions.TransactionDetailModel> details = new Collection<MixERP.Net.Common.Models.Transactions.TransactionDetailModel>();
            long transactionMasterId = 0;

            if(grid != null)
            {
                if(grid.Rows.Count > 0)
                {
                    foreach(GridViewRow row in grid.Rows)
                    {
                        MixERP.Net.Common.Models.Transactions.TransactionDetailModel detail = new MixERP.Net.Common.Models.Transactions.TransactionDetailModel();
                        detail.AccountCode = row.Cells[0].Text;
                        detail.CashRepositoryName = row.Cells[2].Text;
                        detail.StatementReference = row.Cells[3].Text.Replace("&nbsp;", " ").Trim();
                        detail.Debit = MixERP.Net.Common.Conversion.TryCastDecimal(row.Cells[4].Text);
                        detail.Credit = MixERP.Net.Common.Conversion.TryCastDecimal(row.Cells[5].Text);

                        details.Add(detail);
                    }
                }
            }

            transactionMasterId = MixERP.Net.DatabaseLayer.Transactions.Transaction.Add(valueDate, MixERP.Net.BusinessLayer.Helpers.SessionHelper.GetOfficeId(), MixERP.Net.BusinessLayer.Helpers.SessionHelper.GetUserId(), MixERP.Net.BusinessLayer.Helpers.SessionHelper.GetLogOnId(), costCenterId, referenceNumber, details);
            MixERP.Net.DatabaseLayer.Transactions.Verification.CallAutoVerification(transactionMasterId);
            return transactionMasterId;
        }
开发者ID:n4gava,项目名称:mixerp,代码行数:27,代码来源:Transaction.cs


示例18: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            GridView grid = new GridView();
            DataTable dt = new DataTable();
            List<Usuario> lista = new List<Usuario>();
            UsuarioBL uBL = new UsuarioBL();
            lista = uBL.buscaUsuariosEmpresa(Convert.ToInt16(Session["empresa"].ToString()));

            DataColumn c1 = new DataColumn("Email", Type.GetType("System.String"));
            DataColumn c2 = new DataColumn("Nome", Type.GetType("System.String"));
            DataColumn c3 = new DataColumn("Empresa", Type.GetType("System.String"));
            DataColumn c4 = new DataColumn("Licença", Type.GetType("System.String"));
            DataColumn c5 = new DataColumn("editar", Type.GetType("System.String"));

            dt.Columns.Add(c1);
            dt.Columns.Add(c2);
            dt.Columns.Add(c3);
            dt.Columns.Add(c4);
            dt.Columns.Add(c5);

            foreach (Usuario u in lista)
            {
                DataRow dr = dt.NewRow();
                dr["Email"] = u.email.ToString();
                dr["Nome"] = u.nome.ToString();
                dr["Empresa"] = u.idEmpresa.ToString();
                dr["Licença"] = u.dataFimLicenca.ToShortDateString();
                dr["editar"] = "~/EditarUsuario.aspx?user_mail=" + u.email.ToString();
                dt.Rows.Add(dr);
            }
            gridUsuarios.DataSource = dt.Copy();
            gridUsuarios.DataBind();
        }
开发者ID:CPicinin,项目名称:Repository_PDM,代码行数:33,代码来源:ConsultaUsuario.aspx.cs


示例19: 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


示例20: UpdateRoomInventoryGrid

        public static void UpdateRoomInventoryGrid(GridView gv)
        {
            if (roomInventoryList.Count + editRoom.Inventories.Count() == 0 || roomInventoryList.Count + editRoom.Inventories.Count() != gv.Rows.Count)
            {
                return;
            }

            int i;
            for (i = 0; i < editRoom.Inventories.Count(); i++)
            {
                var row = gv.Rows[i];
                var inventory = editRoom.Inventories[i];
                row.BackColor = Color.LightGray;
                row.Cells[0].Text = inventory.ProductName;
                row.Cells[1].Text = inventory.InventoryType.Type;
                row.Cells[2].Text = inventory.Status;
            }

            if (i > 0)
            {
                gv.Rows[i - 1].CssClass = "BorderRow";
            }

            for (var j = i; j - i < roomInventoryList.Count; j++)
            {
                var row = gv.Rows[j];
                var inventory = roomInventoryList[j - i];
                row.Cells[0].Text = inventory.ProductName;
                row.Cells[1].Text = inventory.InventoryType.Type;
                row.Cells[2].Text = inventory.Status;
            }
        }
开发者ID:esfdk,项目名称:itubs,代码行数:32,代码来源:EditRoomViewModel.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# WebControls.GridViewCancelEditEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# WebControls.FormViewUpdatedEventArgs类代码示例发布时间: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