Пример #1
0
 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);
 }
Пример #2
0
        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;
        }
Пример #3
0
        private void grdBalanceDrawRequest_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            System.Web.UI.WebControls.GridViewRow gridViewRow = (System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer;
            int userId = (int)this.grdBalanceDrawRequest.DataKeys[gridViewRow.RowIndex].Value;

            if (e.CommandName == "UnLineReCharge")
            {
                if (MemberHelper.DealBalanceDrawRequest(userId, true))
                {
                    this.BindBalanceDrawRequest();
                }
                else
                {
                    this.ShowMsg("预付款提现申请操作失败", false);
                }
            }
            if (e.CommandName == "RefuseRequest")
            {
                if (MemberHelper.DealBalanceDrawRequest(userId, false))
                {
                    this.BindBalanceDrawRequest();
                    return;
                }
                this.ShowMsg("预付款提现申请操作失败", false);
            }
        }
Пример #4
0
 private void ImageTypeEdit_Click(object sender, System.EventArgs e)
 {
     System.Collections.Generic.Dictionary <int, string> dictionary = new System.Collections.Generic.Dictionary <int, string>();
     for (int i = 0; i < this.ImageTypeList.Rows.Count; i++)
     {
         System.Web.UI.WebControls.GridViewRow gridViewRow = this.ImageTypeList.Rows[i];
         string text = ((System.Web.UI.WebControls.TextBox)gridViewRow.Cells[1].FindControl("ImageTypeName")).Text;
         if (text.Length > 20)
         {
             this.ShowMsg("分类长度限在20个字符以内", false);
             return;
         }
         int key = System.Convert.ToInt32(this.ImageTypeList.DataKeys[i].Value);
         dictionary.Add(key, Globals.HtmlEncode(text.ToString()));
     }
     try
     {
         int num = GalleryHelper.UpdatePhotoCategories(dictionary);
         if (num > 0)
         {
             this.ShowMsg("保存成功!", true);
         }
         else
         {
             this.ShowMsg("保存失败!", false);
         }
     }
     catch
     {
         this.ShowMsg("保存失败!", false);
     }
 }
Пример #5
0
        private void grdExpressTemplates_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            System.Web.UI.WebControls.GridViewRow gridViewRow = (System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer;
            int num = (int)this.grdExpressTemplates.DataKeys[gridViewRow.RowIndex].Value;

            if (e.CommandName == "SetYesOrNo")
            {
                SalesHelper.SetExpressIsUse(num);
                this.BindExpressTemplates();
                return;
            }
            if (!(e.CommandName == "DeleteRow"))
            {
                if (e.CommandName == "IsDefault")
                {
                    SettingsHelper.SetExpressIsDefault(num);
                    this.BindExpressTemplates();
                }
                return;
            }
            if (SalesHelper.DeleteExpressTemplate(num))
            {
                System.Web.UI.WebControls.Literal literal = this.grdExpressTemplates.Rows[gridViewRow.RowIndex].FindControl("litXmlFile") as System.Web.UI.WebControls.Literal;
                this.DeleteXmlFile(literal.Text);
                this.BindExpressTemplates();
                this.ShowMsg("已经成功删除选择的快递单模板", true);
                return;
            }
            this.ShowMsg("删除快递单模板失败", false);
        }
Пример #6
0
        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;
        }
Пример #7
0
        /// <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);
                        }

                    }
                }
            }
        }
Пример #8
0
        private bool validata(string theme)
        {
            DropdownColumn dropdownColumn = (DropdownColumn)this.grdTopCategries.Columns[1];

            System.Collections.IEnumerator enumerator = this.grdTopCategries.Rows.GetEnumerator();
            bool result;

            try
            {
                while (enumerator.MoveNext())
                {
                    System.Web.UI.WebControls.GridViewRow gridViewRow = (System.Web.UI.WebControls.GridViewRow)enumerator.Current;
                    string a = dropdownColumn.SelectedValues[gridViewRow.RowIndex];
                    if (a == theme)
                    {
                        result = false;
                        return(result);
                    }
                }
                return(true);
            }
            finally
            {
                System.IDisposable disposable = enumerator as System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            return(result);
        }
Пример #9
0
 protected override void InitializePager(GridViewRow row, int columnSpan, PagedDataSource pagedDataSource)
 {
     if (UseCustomPager)
         CreateCustomPager(row, columnSpan, pagedDataSource);
     else
         base.InitializePager(row, columnSpan, pagedDataSource);
 }
Пример #10
0
        /// <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);
                }
            }
        }
Пример #11
0
        /// <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();
            //};
        }
Пример #12
0
        public static int GetGridViewInt(GridViewRow gvr, int columnIndex)
        {
            int returnValue = -1;

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

            return returnValue;
        }
Пример #13
0
 protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     index = Convert.ToInt32(e.CommandArgument);
     selectedRow = GridView2.Rows[index];
     contactName = selectedRow.Cells[2];
     codLeilao = Convert.ToInt32(contactName.Text);
     Response.Redirect("CadastroLance.aspx", true);
 }
Пример #14
0
 protected override void InitializeBottomPager(System.Web.UI.WebControls.GridViewRow row, int columnSpan, System.Web.UI.WebControls.PagedDataSource pagedDataSource)
 {
     if (this.PageIndex != this.VirtualPageIndex)
     {
         this.PageIndex = this.VirtualPageIndex;
     }
     base.InitializeBottomPager(row, columnSpan, pagedDataSource);
 }
Пример #15
0
        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);
            }
        }
Пример #16
0
        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");
            }
        }
Пример #17
0
 /**/
 /// <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));
     }
 }
Пример #18
0
		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
		}
Пример #19
0
 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;
 }
Пример #20
0
 private void grdUnderlingGrades_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
 {
     if (e.CommandName == "SetYesOrNo")
     {
         System.Web.UI.WebControls.GridViewRow gridViewRow = (System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer;
         int defalutUnderlingGrade = (int)this.grdUnderlingGrades.DataKeys[gridViewRow.RowIndex].Value;
         UnderlingHelper.SetDefalutUnderlingGrade(defalutUnderlingGrade);
         this.BindUnderlingGrades();
     }
 }
Пример #21
0
 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 "";
 }
Пример #22
0
        /// <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 );
        }
Пример #23
0
 private void grdExpressTemplates_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
 {
     if (e.CommandName == "SetYesOrNo")
     {
         System.Web.UI.WebControls.GridViewRow gridViewRow = (System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer;
         int expressIsUse = (int)this.grdExpressTemplates.DataKeys[gridViewRow.RowIndex].Value;
         SalesHelper.SetExpressIsUse(expressIsUse);
         this.BindExpressTemplates();
     }
 }
Пример #24
0
        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");
            }
        }
Пример #25
0
        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;
        }
 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;
 }
 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 "";
 }
Пример #28
0
		/// <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";
			}
		}
Пример #29
0
 //renjinquan 改为 internal
 internal void IndicateNoData(Object p_objColumn, GridViewRow p_objRow)
 {
     if (p_objColumn == DBNull.Value)
     {
         p_objRow.Attributes.Add("title", "无数据");
         foreach (TableCell cell in p_objRow.Cells)
         {
             cell.Style.Add(HtmlTextWriterStyle.BackgroundColor, "pink");
         }
     }
 }
Пример #30
0
        private void grdAuthorizeProducts_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            System.Web.UI.WebControls.GridViewRow gridViewRow = (System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer;
            int productId = (int)this.grdAuthorizeProducts.DataKeys[gridViewRow.RowIndex].Value;

            if (e.CommandName == "download")
            {
                SubSiteProducthelper.DownloadProduct(productId, this.isDownCategory.Checked);
                this.ReBindData(false);
            }
        }
Пример #31
0
 public static int GetColumnIndexByName(GridViewRow row, string columnName)
 {
     int columnIndex = 0;
     foreach (DataControlFieldCell cell in row.Cells)
     {
         if (cell.ContainingField is BoundField)
             if (((BoundField)cell.ContainingField).DataField.Equals(columnName))
                 break;
         columnIndex++; // keep adding 1 while we don't have the correct name
     }
     return columnIndex;
 }
Пример #32
0
		/// <summary>
		/// 设置当鼠标移动到数据行时的样式
		/// </summary>
		/// <param name="row"></param>
		internal static void SetRowStyleWhenMouseOver(GridViewRow row)
		{
			row.Attributes["onmouseover"] = "this.className = 'selecteditem';";
			if (row.RowState == DataControlRowState.Alternate)
			{
				row.Attributes["onmouseout"] = "this.className = 'aitem';";
			}
			else
			{
				row.Attributes["onmouseout"] = "this.className = 'item';";
			}
		}
Пример #33
0
        protected string GetChartUrl(object container)
        {
            if (MyDashboardMode)
            {
                return(" ");
            }
            System.Web.UI.WebControls.GridViewRow ri = container as System.Web.UI.WebControls.GridViewRow;
            MetricTrac.Bll.ScoreCardMetric.Extend v  = (MetricTrac.Bll.ScoreCardMetric.Extend)ri.DataItem;
            string FreqDate = DTNow.ToString("MM-dd-yyyy");

            return("DataValueChart.aspx?ScoreCardMetricID=" + v.ScoreCardMetricID + "&Date=" + FreqDate);
        }
        /// <summary>Gets the ID of the lead entry in the given row.</summary>
        /// <param name="row">The row from which to get the lead ID.</param>
        /// <returns>THe ID of the lead in the given row, or <c>null</c> if there isn't a lead in that row</returns>
        private static int? GetLeadItemId(GridViewRow row)
        {
            var hdnLeadId = row.FindControl("hdnLeadId") as HiddenField;

            int leadId;
            if (hdnLeadId != null && int.TryParse(hdnLeadId.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out leadId))
            {
                return leadId;
            }

            return null;
        }
Пример #35
0
		/// <summary>
		/// 设置当鼠标移动到数据行时的样式
		/// </summary>
		/// <param name="row"></param>
		internal static void SetRowStyleWhenMouseOver(GridViewRow row, string selectedCss, string alternatingRowCss, string rowCss)
		{
			row.Attributes["onmouseover"] = string.Format("this.className = '{0}';", selectedCss);
			if (row.RowState == DataControlRowState.Alternate)
			{
				row.Attributes["onmouseout"] = string.Format("this.className = '{0}';", alternatingRowCss);
			}
			else
			{
				row.Attributes["onmouseout"] = string.Format("this.className = '{0}';", rowCss);
			}
		}
Пример #36
0
 public static IOrderedDictionary GetValues(GridViewRow row)
 {
     IOrderedDictionary values = new OrderedDictionary();
     foreach (DataControlFieldCell cell in row.Cells)
     {
         if(cell.Visible)
         {
             cell.ContainingField.ExtractValuesFromCell(values, cell, row.RowState, true);
         }
     }
     return values;
 }
Пример #37
0
 protected override void InitializePager(GridViewRow row, int columnSpan, PagedDataSource pagedDataSource)
 {
     // This method is called to initialise the pager on the grid. We intercepted this and override
     // the values of pagedDataSource to achieve the custom paging using the default pager supplied
     if (CustomPaging)
     {
         pagedDataSource.AllowCustomPaging = true;
         pagedDataSource.VirtualCount = VirtualItemCount;
         pagedDataSource.CurrentPageIndex = CurrentPageIndex;
     }
     base.InitializePager(row, columnSpan, pagedDataSource);
 }
Пример #38
0
 public static void BuildLookupValueReturnControl(System.Web.UI.WebControls.GridViewRow e, string LinkControlId)
 {
     if (e.RowType == DataControlRowType.DataRow)
     {
         System.Web.UI.WebControls.HyperLink hl = new System.Web.UI.WebControls.HyperLink();
         string js;
         hl             = (System.Web.UI.WebControls.HyperLink)(e.FindControl(LinkControlId));
         js             = BuildJS_ReturnLookupValue(System.Web.HttpContext.Current.Request.QueryString["setLookupValueToControlID"], e.Cells[0].Text);
         hl.NavigateUrl = "javascript://";
         hl.Attributes.Add("onclick", js);
     }
 }
Пример #39
0
 private void AddSortImage(int columnIndex, GridViewRow headerRow)
 {
     Image sortImage = new Image();
     if ((SortDirection)ViewState["SortDirection"] == SortDirection.Ascending)
     {
         sortImage.ImageUrl = "~/Images/up.jpg";
     }
     else
     {
         sortImage.ImageUrl = "~/Images/down.jpg";
     }
     headerRow.Cells[columnIndex].Controls.Add(sortImage);
 }
Пример #40
0
 private void grdMemberRankList_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
 {
     if (e.CommandName == "SetYesOrNo")
     {
         System.Web.UI.WebControls.GridViewRow namingContainer = (System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer;
         int gradeId = (int)this.grdMemberRankList.DataKeys[namingContainer.RowIndex].Value;
         if (!MemberHelper.GetMemberGrade(gradeId).IsDefault)
         {
             MemberHelper.SetDefalutMemberGrade(gradeId);
             this.BindMemberRanks();
         }
     }
 }
Пример #41
0
        /// <summary>
        ///Customizes the Text on the Pager Row of a GridView to be BEAR Compliant.
        ///If the GridView has select turned on, this will need to be called from the OnSelectedIndexChanged event as
        ///well as the OnRowBound event.
        ///
        /// displays "Page x of xx     Change Page: " in the pager row
        /// </summary>
        /// <param name="gv">ID of the asp:GridView</param>
        /// <param name="pagerRow">pass in the pager row.  Generally (in BEAR) with e.Row or GridViewID.BottomPagerRow </param>
        public void GridViewCustomizePagerRow(GridView gv, GridViewRow pagerRow)
        {
            int currentPage = (int)gv.PageIndex + 1;
            TableCell newCell = new TableCell();
            newCell.Text = "<span class='pageCount'>Page "
                        + currentPage
                        + " of "
                        + gv.PageCount
                        + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Change Page: ";
            Table tbl = (Table)pagerRow.Cells[0].Controls[0];
            tbl.Rows[0].Cells.AddAt(0, newCell);

        }
Пример #42
0
 private void grdShippers_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
 {
     if (e.CommandName == "SetYesOrNo")
     {
         System.Web.UI.WebControls.GridViewRow namingContainer = (System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer;
         int shipperId = (int)this.grdShippers.DataKeys[namingContainer.RowIndex].Value;
         if (!SalesHelper.GetShipper(shipperId).IsDefault)
         {
             SalesHelper.SetDefalutShipper(shipperId);
             this.BindShippers();
         }
     }
 }
Пример #43
0
        protected string GetOrderIds()
        {
            string text = string.Empty;

            for (int i = 0; i < this.grdOrderGoods.Rows.Count; i++)
            {
                System.Web.UI.WebControls.GridViewRow arg_1B_0 = this.grdOrderGoods.Rows[i];
                text = text + this.grdOrderGoods.DataKeys[i].Value.ToString() + ",";
            }
            return(text.TrimEnd(new char[]
            {
                ','
            }));
        }
Пример #44
0
        private void dropAddToCategories_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            DistributorProductCategoriesDropDownList distributorProductCategoriesDropDownList = (DistributorProductCategoriesDropDownList)sender;

            System.Web.UI.WebControls.GridViewRow gridViewRow = (System.Web.UI.WebControls.GridViewRow)distributorProductCategoriesDropDownList.NamingContainer;
            if (distributorProductCategoriesDropDownList.SelectedValue.HasValue)
            {
                SubsiteCatalogHelper.SetProductExtendCategory((int)this.grdProducts.DataKeys[gridViewRow.RowIndex].Value, SubsiteCatalogHelper.GetCategory(distributorProductCategoriesDropDownList.SelectedValue.Value).Path + "|");
                this.ReBind();
                return;
            }
            SubsiteCatalogHelper.SetProductExtendCategory((int)this.grdProducts.DataKeys[gridViewRow.RowIndex].Value, null);
            this.ReBind();
        }
Пример #45
0
        private void dropAddToCategories_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            ProductCategoriesDropDownList list = (ProductCategoriesDropDownList)sender;

            System.Web.UI.WebControls.GridViewRow namingContainer = (System.Web.UI.WebControls.GridViewRow)list.NamingContainer;
            if (list.SelectedValue.HasValue)
            {
                CatalogHelper.SetProductExtendCategory((int)this.grdProducts.DataKeys[namingContainer.RowIndex].Value, CatalogHelper.GetCategory(list.SelectedValue.Value).Path + "|");
                this.ReBind(false);
            }
            else
            {
                CatalogHelper.SetProductExtendCategory((int)this.grdProducts.DataKeys[namingContainer.RowIndex].Value, null);
                this.ReBind(false);
            }
        }
Пример #46
0
        protected override void InitializePager(ASP.GridViewRow row, int columnSpan, ASP.PagedDataSource pagedDataSource)
        {
            this.virtualItemCount = pagedDataSource.DataSourceCount;
            bool hide = (this.hidePagerOnOnePage && pagedDataSource.PageCount <= 1);

            if (!hide)
            {
                if (this.UseCoolPager)
                {
                    this.CreateCoolPager(row, columnSpan, pagedDataSource);
                }
                else
                {
                    base.InitializePager(row, columnSpan, pagedDataSource);
                }
            }
        }
Пример #47
0
        protected override void InitializePager(System.Web.UI.WebControls.GridViewRow row, int columnSpan, System.Web.UI.WebControls.PagedDataSource pagedDataSource)
        {
            HtmlGenericControl ul = new HtmlGenericControl("ul");

            ul.Attributes.Add("class", "pagination pull-right");

            AddPager(ul, commandArgument: "First", text: "<span class='glyphicon glyphicon-fast-backward'></span>");

            for (int i = 0; i < PageCount; i++)
            {
                AddPager(ul, i);
            }

            AddPager(ul, commandArgument: "Last", text: "<span class='glyphicon glyphicon-fast-forward'></span>");

            row.CssClass = "table-footer";
            row.Cells.Add(new System.Web.UI.WebControls.TableCell());
            row.Cells[0].ColumnSpan = columnSpan;
            row.Cells[0].Controls.AddAt(0, ul);
        }
Пример #48
0
        protected override void RaisePostBackEvent(string eventArgument)
        {
            int index = eventArgument.IndexOf('$');

            if (index >= 0)
            {
                string commandName = eventArgument.Substring(0, index);
                string commandArg  = eventArgument.Substring(index + 1);
                switch (commandName)
                {
                case "rc":
                    int                       rowIndex = Int32.Parse(commandArg);
                    ASP.GridViewRow           row      = base.Rows[rowIndex];
                    GridViewRowClickEventArgs args     = new GridViewRowClickEventArgs(row, commandName, commandArg);
                    this.OnRowClick(args);
                    break;

                default:
                    base.RaisePostBackEvent(eventArgument);
                    break;
                }
            }
        }
Пример #49
0
        private void DetermineRowClickAction(ASP.GridViewRow row)
        {
            string commandName = null;
            string commandArg  = null;

            switch (this.RowClickEvent)
            {
            case RowClickEvent.Click:
                commandName = "click";
                commandArg  = row.RowIndex.ToString();
                break;

            case RowClickEvent.Edit:
                commandName = "edit";
                commandArg  = row.RowIndex.ToString();
                break;

            case RowClickEvent.Select:
                commandName = "select";
                commandArg  = row.RowIndex.ToString();
                break;
            }
            if (!Utils.ContainsControlType(row, NORENDER_CLICK_TYPES))
            {
                this.SetClickEvent(row, commandName, commandArg); // set on tr
            }
            else
            {
                foreach (ASP.TableCell cell in row.Cells)
                {
                    if (!Utils.ContainsControlType(cell, NORENDER_CLICK_TYPES))
                    {
                        this.SetClickEvent(cell, commandName, commandArg);
                    }
                }
            }
        }
Пример #50
0
        protected override void InitializePager(System.Web.UI.WebControls.GridViewRow row, int columnSpan, System.Web.UI.WebControls.PagedDataSource pagedDataSource)
        {
            base.InitializePager(row, columnSpan, pagedDataSource);
            int recordCount = pagedDataSource.DataSourceCount;

            LinkButton First = new LinkButton();
            LinkButton Prev  = new LinkButton();
            LinkButton Next  = new LinkButton();
            LinkButton Last  = new LinkButton();

            TableCell tc = new TableCell();

            row.Controls.Clear();

            tc.Controls.Add(new LiteralControl("&nbsp"));

            #region 显示总记录数 每页记录数 当前页数/总页数
            string textFormat = String.Format(_pagertextFormat,
                                              PageSize,
                                              TotalRecordCount == 0 ? recordCount : TotalRecordCount,
                                              PageIndex + 1,
                                              PageCount);
            tc.Controls.Add(new LiteralControl(textFormat));
            tc.Controls.Add(new LiteralControl("&nbsp"));
            #endregion

            #region 设置“首页 上一页 下一页 末页”按钮
            First.Text            = "首页";
            First.CommandName     = "Page";
            First.CommandArgument = "First";
            First.CssClass        = "listViewTdLinkS1";

            Prev.Text            = "上一页";
            Prev.CommandName     = "Page";
            Prev.CommandArgument = "Prev";
            Prev.CssClass        = "listViewTdLinkS1";

            Next.Text            = "下一页";
            Next.CommandName     = "Page";
            Next.CommandArgument = "Next";
            Next.CssClass        = "listViewTdLinkS1";

            Last.Text            = "末页";
            Last.CommandName     = "Page";
            Last.CommandArgument = "Last";
            Last.CssClass        = "listViewTdLinkS1";

            if (PageIndex <= 0)
            {
                First.Enabled = Prev.Enabled = false;
            }
            else
            {
                First.Enabled = Prev.Enabled = true;
            }

            if (PageIndex >= PageCount - 1)
            {
                Next.Enabled = Last.Enabled = false;
            }
            else
            {
                Next.Enabled = Last.Enabled = true;
            }

            tc.Controls.Add(First);
            tc.Controls.Add(new LiteralControl("&nbsp;"));
            tc.Controls.Add(Prev);
            tc.Controls.Add(new LiteralControl("&nbsp;"));
            tc.Controls.Add(Next);
            tc.Controls.Add(new LiteralControl("&nbsp"));
            tc.Controls.Add(Last);
            tc.Controls.Add(new LiteralControl("&nbsp;"));


            #endregion

            #region 设置转至指定页
            tc.Controls.Add(new LiteralControl("&nbsp跳转至第"));
            TextBox tbx_go = new TextBox();
            tbx_go.ID    = "_tbx_page_go";
            tbx_go.Text  = (PageIndex + 1).ToString();
            tbx_go.Width = Unit.Pixel(30);
            tc.Controls.Add(tbx_go);
            tc.Controls.Add(new LiteralControl("页"));

            RangeValidator rg = new RangeValidator();
            rg.ControlToValidate = "_tbx_page_go";
            rg.MinimumValue      = "1";
            if (PageCount != 0)
            {
                rg.MaximumValue = PageCount.ToString();
            }
            else
            {
                rg.MaximumValue = rg.MinimumValue;
            }
            rg.ErrorMessage    = "页码范围无效";
            rg.ValidationGroup = "_checkpage";
            rg.Display         = ValidatorDisplay.Dynamic;
            rg.Type            = ValidationDataType.Integer;
            tc.Controls.Add(rg);

            Button bt_go = new Button();
            bt_go.Text            = "GO";
            bt_go.Click          += new EventHandler(bt_go_Click);
            bt_go.ValidationGroup = "_checkpage";
            tc.Controls.Add(bt_go);
            #endregion

            if (this.AutoGenerateColumns)
            {
                if (this.DataSource != null && this.DataSource.GetType().FullName == "System.Data.DataTable")
                {
                    tc.ColumnSpan = ((DataTable)this.DataSource).Columns.Count + this.Columns.Count;
                }
                else
                {
                    tc.ColumnSpan = 5;
                }
            }
            else
            {
                tc.ColumnSpan = this.Columns.Count;
            }

            row.Controls.Add(tc);
        }
Пример #51
0
        protected override void InitializePager(GridViewRow row, int columnSpan, PagedDataSource pagedDataSource)
        {
            this.PagedDataSource = pagedDataSource;
            this.RowCount        = pagedDataSource.DataSourceCount;
            System.Web.UI.WebControls.GridViewRow bottonPagerRow = row;
            if (bottonPagerRow != null)
            {
                _pageDDL = new DropDownList();
                _pageDDL.AutoPostBack          = true;
                _pageDDL.ID                    = "PageDDL";
                _pageDDL.SelectedIndexChanged += new EventHandler(_pageDDL_SelectedIndexChanged);
                _pageDDL.Style.Add(HtmlTextWriterStyle.VerticalAlign, "Middle");
                _buttonGO             = new Button();
                _buttonGO.ID          = "ButtonGO";
                _buttonGO.CommandName = "GO";

                _buttonGO.Text   = "GO";
                _buttonGO.Click += new EventHandler(_buttonGO_Click);

                TableCell cell = new TableCell();
                cell.ColumnSpan = columnSpan;


                bottonPagerRow.Cells.Add(cell);
                bottonPagerRow.Cells[0].ID = "DDD";
                bottonPagerRow.Cells[0].HorizontalAlign = HorizontalAlign.Center;
                bottonPagerRow.Cells[0].VerticalAlign   = VerticalAlign.Middle;

                Label bottonPagerNo = new Label();


                bottonPagerNo.Text = string.Format("共 {0} 筆 {1}頁  ", pagedDataSource.DataSourceCount, this.PageCount);
                bottonPagerRow.Cells[0].Controls.Add(bottonPagerNo);

                //ImageButton _buttonFirst = new ImageButton();
                //_buttonFirst.ImageUrl = "~/images/button/Enabled/最初頁.gif";
                //ImageButton _buttonPre = new ImageButton();
                //_buttonPre.ImageUrl = "~/images/button/Enabled/上一頁.gif";
                //ImageButton _buttonNext = new ImageButton();
                //_buttonNext.ImageUrl = "~/images/button/Enabled/下一頁.gif";
                //ImageButton _buttonLast = new ImageButton();
                //_buttonLast.ImageUrl = "~/images/button/Enabled/最末頁.gif";
                //bottonPagerRow.Cells[0].Controls.Add(_buttonFirst);
                //bottonPagerRow.Cells[0].Controls.Add(_buttonPre);
                //bottonPagerRow.Cells[0].Controls.Add(_buttonNext);
                //bottonPagerRow.Cells[0].Controls.Add(_buttonLast);

                Button _buttonFirst = new Button();
                _buttonFirst.CausesValidation = false;
                _buttonFirst.ID = "ButtonFirst";
                _buttonFirst.Style.Add(HtmlTextWriterStyle.VerticalAlign, "Middle");
                _buttonFirst.Click += new EventHandler(_buttonFirst_Click);
                _buttonFirst.Text   = "最初頁";

                Button _buttonPre = new Button();
                _buttonPre.CausesValidation = false;
                _buttonPre.ID = "ButtonPre";
                _buttonPre.Style.Add(HtmlTextWriterStyle.VerticalAlign, "Middle");
                _buttonPre.Click += new EventHandler(_buttonPre_Click);
                _buttonPre.Text   = "上一頁";

                Button _buttonNext = new Button();
                _buttonNext.CausesValidation = false;
                _buttonNext.ID = "ButtonNext";
                _buttonNext.Style.Add(HtmlTextWriterStyle.VerticalAlign, "Middle");
                _buttonNext.Click += new EventHandler(_buttonNext_Click);
                _buttonNext.Text   = "下一頁";

                Button _buttonLast = new Button();
                _buttonLast.CausesValidation = false;
                _buttonLast.ID = "ButtonLast";
                _buttonLast.Style.Add(HtmlTextWriterStyle.VerticalAlign, "Middle");
                _buttonLast.Click += new EventHandler(_buttonLast_Click);
                _buttonLast.Text   = "最末頁";
                if (this.PageIndex == 0)
                {
                    _buttonFirst.Enabled = false;
                    _buttonPre.Enabled   = false;
                }
                if (this.PageIndex == this.PageCount - 1)
                {
                    _buttonLast.Enabled = false;
                    _buttonNext.Enabled = false;
                }

                bottonPagerRow.Cells[0].Controls.Add(_buttonFirst);
                bottonPagerRow.Cells[0].Controls.Add(_buttonPre);
                bottonPagerRow.Cells[0].Controls.Add(_buttonNext);
                bottonPagerRow.Cells[0].Controls.Add(_buttonLast);

                Label bottonPagerNo2 = new Label();
                bottonPagerNo2.Text = "  至第 ";
                bottonPagerRow.Cells[0].Controls.Add(bottonPagerNo2);


                for (int _i = 1; _i <= this.PageCount; _i++)
                {
                    _pageDDL.Items.Add(new ListItem(_i.ToString(), _i.ToString()));
                }

                if (this.PageIndex >= 0)
                {
                    _pageDDL.Text = (this.PageIndex + 1).ToString();
                }
                bottonPagerRow.Cells[0].Controls.Add(_pageDDL);
                Label bottonPagerNo3 = new Label();
                bottonPagerNo3.Text = "  頁";
                bottonPagerRow.Cells[0].Controls.Add(bottonPagerNo3);
                //bottonPagerRow.Cells[0].Controls.Add(_buttonGO);
                return;
            }
        }
Пример #52
0
 MetricTrac.Bll.MetricValue.Extend GetValue(object container)
 {
     System.Web.UI.WebControls.GridViewRow ri = container as System.Web.UI.WebControls.GridViewRow;
     return(ri.DataItem as MetricTrac.Bll.MetricValue.Extend);
 }
Пример #53
0
        private void InitCustomPager(System.Web.UI.WebControls.GridViewRow row, int columnSpan, System.Web.UI.WebControls.PagedDataSource pagedDataSource)
        {
            var pnlPager = new Panel();
            var _with1   = pnlPager;

            _with1.ID       = "pnlPager";
            _with1.CssClass = PagerStyle.CssClass;

            var tblPager = new Table();
            var _with2   = tblPager;

            _with2.ID          = "tblPager";
            _with2.CellPadding = 3;
            _with2.CellSpacing = 0;
            _with2.Style.Add("width", "100%");
            _with2.Style.Add("height", "100%");
            _with2.BorderStyle = BorderStyle.None;
            _with2.GridLines   = GridLines.None;

            var trPager = new TableRow();

            trPager.ID = "trPager";

            var ltlPageIndex = new Literal();

            ltlPageIndex.ID   = "ltlPageIndex";
            ltlPageIndex.Text = (PageIndex + 1).ToString();

            var ltlPageCount = new Literal();

            ltlPageCount.ID   = "ltlPageCount";
            ltlPageCount.Text = PageCount.ToString();

            var tcPageXofY = new TableCell();
            var _with3     = tcPageXofY;

            _with3.ID = "tcPageXofY";
            _with3.Controls.Add(new LiteralControl("Page "));
            _with3.Controls.Add(ltlPageIndex);
            _with3.Controls.Add(new LiteralControl(" of "));
            _with3.Controls.Add(ltlPageCount);

            var ibtnFirst = new ImageButton();
            var _with4    = ibtnFirst;

            _with4.ID          = "ibtnFirst";
            _with4.CommandName = "First";
            _with4.ToolTip     = "First Page";
            _with4.Style.Add("cursor", "pointer");
            _with4.CausesValidation = false;
            _with4.Command         += PagerCommand;

            var ibtnPrevious = new ImageButton();
            var _with5       = ibtnPrevious;

            _with5.ID          = "ibtnPrevious";
            _with5.CommandName = "Previous";
            _with5.ToolTip     = "Previous Page";
            _with5.ImageAlign  = ImageAlign.AbsMiddle;
            _with5.Style.Add("cursor", "pointer");
            _with5.CausesValidation = false;
            _with5.Command         += PagerCommand;

            var ibtnNext = new ImageButton();
            var _with6   = ibtnNext;

            _with6.ID          = "ibtnNext";
            _with6.CommandName = "Next";
            _with6.ToolTip     = "Next Page";
            _with6.ImageAlign  = ImageAlign.AbsMiddle;
            _with6.Style.Add("cursor", "pointer");
            _with6.CausesValidation = false;
            _with6.Command         += PagerCommand;

            var ibtnLast = new ImageButton();
            var _with7   = ibtnLast;

            _with7.ID          = "ibtnLast";
            _with7.CommandName = "Last";
            _with7.ToolTip     = "Last Page";
            _with7.ImageAlign  = ImageAlign.AbsMiddle;
            _with7.Style.Add("cursor", "pointer");
            _with7.CausesValidation = false;
            _with7.Command         += PagerCommand;

            if (PageIndex > 0)
            {
                ibtnFirst.Enabled    = true;
                ibtnPrevious.Enabled = true;
            }
            else
            {
                ibtnFirst.Enabled    = false;
                ibtnPrevious.Enabled = false;
                ibtnFirst.Style.Add("cursor", "default");
                ibtnPrevious.Style.Add("cursor", "default");
            }

            if (PageIndex < PageCount - 1)
            {
                ibtnNext.Enabled = true;
                ibtnLast.Enabled = true;
            }
            else
            {
                ibtnNext.Enabled = false;
                ibtnLast.Enabled = false;
                ibtnNext.Style.Add("cursor", "default");
                ibtnLast.Style.Add("cursor", "default");
            }

            var tcPagerBtns = new TableCell();
            var _with8      = tcPagerBtns;

            _with8.ID = "tcPagerBtns";
            _with8.Controls.Add(ibtnFirst);
            _with8.Controls.Add(ibtnPrevious);
            _with8.Controls.Add(new LiteralControl("&nbsp;&nbsp;"));
            _with8.Controls.Add(ibtnNext);
            _with8.Controls.Add(ibtnLast);

            var ddlPages = new DropDownList();
            var _with9   = ddlPages;

            _with9.AutoPostBack = true;

            for (var i = 1; i <= PageCount; i += +1)
            {
                _with9.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }
            _with9.SelectedIndex         = PageIndex;
            _with9.CausesValidation      = false;
            _with9.SelectedIndexChanged += ddlPages_SelectedIndexChanged;

            var tcPagerDDL = new TableCell();
            var _with10    = tcPagerDDL;

            _with10.ID = "tcPagerDDL";
            _with10.Controls.Add(new LiteralControl("<table cellpadding=\"0\" cellspacing=\"0\" frame=\"void\" rules=\"none\"><tr><td style=\"padding-right: 5px;border: 0px;\">Page:</td><td style=\"border: 0px;\">"));
            _with10.Controls.Add(ddlPages);
            _with10.Controls.Add(new LiteralControl("</td></tr></table>"));

            //add cells to row
            trPager.Cells.Add(tcPageXofY);
            trPager.Cells.Add(tcPagerBtns);
            trPager.Cells.Add(tcPagerDDL);

            //add row to table
            tblPager.Rows.Add(trPager);

            //add table to div
            pnlPager.Controls.Add(tblPager);

            //add div to pager row
            row.Controls.AddAt(0, new TableCell());
            row.Cells[0].ColumnSpan = columnSpan;
            row.Cells[0].Controls.Add(pnlPager);
        }
Пример #54
0
 public GridViewRowClickEventArgs(ASP.GridViewRow row, string commandName, string commandArgument)
 {
     this.commandName     = commandName;
     this.commandArgument = commandArgument;
     this.row             = row;
 }
 public static TDataItem RowDataItem <TDataItem>(msWebCtrl.WebControl ctrl)
 {
     msWebCtrl.GridViewRow row = (msWebCtrl.GridViewRow)ctrl.NamingContainer;
     return((TDataItem)row.DataItem);
 }
Пример #56
0
 public string parse(string text, string cname, System.Web.UI.WebControls.GridViewRow rowgrid)
 {
     return(_parser.get_string(text, cname, null, null, null, rowgrid));
 }