Esempio n. 1
0
        private string GetRowClass(GridView gridView, GridViewRow row)
        {
            string className = "";

            if ((row.RowState & DataControlRowState.Alternate) == DataControlRowState.Alternate)
            {
                className += " AspNet-GridView-Alternate ";
                if (gridView.AlternatingRowStyle != null)
                {
                    className += gridView.AlternatingRowStyle.CssClass;
                }
            }
            else if (row.Equals(gridView.HeaderRow) && (gridView.HeaderStyle != null) && (!String.IsNullOrEmpty(gridView.HeaderStyle.CssClass)))
            {
                className += " " + gridView.HeaderStyle.CssClass;
            }
            else if (row.Equals(gridView.FooterRow) && (gridView.FooterStyle != null) && (!String.IsNullOrEmpty(gridView.FooterStyle.CssClass)))
            {
                className += " " + gridView.FooterStyle.CssClass;
            }
            else if ((gridView.RowStyle != null) && (!String.IsNullOrEmpty(gridView.RowStyle.CssClass)))
            {
                className += " " + gridView.RowStyle.CssClass;
            }

            if ((row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit)
            {
                className += " AspNet-GridView-Edit ";
                if (gridView.EditRowStyle != null)
                {
                    className += gridView.EditRowStyle.CssClass;
                }
            }

            if ((row.RowState & DataControlRowState.Insert) == DataControlRowState.Insert)
            {
                className += " AspNet-GridView-Insert ";
            }

            if ((row.RowState & DataControlRowState.Selected) == DataControlRowState.Selected)
            {
                className += " AspNet-GridView-Selected ";
                if (gridView.SelectedRowStyle != null)
                {
                    className += gridView.SelectedRowStyle.CssClass;
                }
            }

            //// EmptyDataTemplate
            if ((row.RowType & DataControlRowType.EmptyDataRow) == DataControlRowType.EmptyDataRow)
            {
                className += " AspNet-GridView-Empty ";
            }

            return(className.Trim());
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the row class.
        /// </summary>
        /// <param name="gridView">
        /// The grid view.
        /// </param>
        /// <param name="row">
        /// The row.
        /// </param>
        /// <returns>
        /// The get row class.
        /// </returns>
        /// <remarks>
        /// </remarks>
        private static string GetRowClass(GridView gridView, GridViewRow row)
        {
            var className = string.Empty;

            if ((row.RowState & DataControlRowState.Alternate) == DataControlRowState.Alternate)
            {
                className += " AspNet-GridView-Alternate ";
                className += gridView.AlternatingRowStyle.CssClass;
            }
            else if (row.Equals(gridView.HeaderRow) && (!String.IsNullOrEmpty(gridView.HeaderStyle.CssClass)))
            {
                className += " " + gridView.HeaderStyle.CssClass;
            }
            else if (row.Equals(gridView.FooterRow) && (!String.IsNullOrEmpty(gridView.FooterStyle.CssClass)))
            {
                className += " " + gridView.FooterStyle.CssClass;
            }
            else if (!String.IsNullOrEmpty(gridView.RowStyle.CssClass))
            {
                className += " " + gridView.RowStyle.CssClass;
            }

            if ((row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit)
            {
                className += " AspNet-GridView-Edit ";
                className += gridView.EditRowStyle.CssClass;
            }

            if ((row.RowState & DataControlRowState.Insert) == DataControlRowState.Insert)
            {
                className += " AspNet-GridView-Insert ";
            }

            if ((row.RowState & DataControlRowState.Selected) == DataControlRowState.Selected)
            {
                className += " AspNet-GridView-Selected ";
                className += gridView.SelectedRowStyle.CssClass;
            }

            return(className.Trim());
        }