Exemplo n.º 1
0
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            GridView
                tmpGridView;

            if ((tmpGridView = sender as GridView) == null)
            {
                return;
            }

            string
                tmpString = "GridView_RowDataBound(sender.GetType().FullName=\"" + sender.GetType().FullName + "\" e.GetType().FullName=\"" + e.GetType().FullName + "\")";

            if (tmpString != string.Empty)
            {
                LogII.LogII.MakeFile(LogII.LogII.MakeLogFileName(), tmpString, true);
            }

            DataRowView
                tmpDataRowView;

            if ((tmpDataRowView = e.Row.DataItem as System.Data.DataRowView) != null)
            {
                LogII.LogII.MakeFile(LogII.LogII.MakeLogFileName(), "System.Data.DataRowView", true);
            }

            DbDataRecord
                tmpDbDataRecord;

            if ((tmpDbDataRecord = e.Row.DataItem as DbDataRecord) != null)
            {
                LogII.LogII.MakeFile(LogII.LogII.MakeLogFileName(), "DbDataRecord", true);
            }

            string
                FieldName = "Salary";

            switch (tmpGridView.ID)
            {
            case "GridView1":
            {
                switch (e.Row.RowType)
                {
                case DataControlRowType.Header:
                {
                    Total = 0m;

                    break;
                }

                case DataControlRowType.DataRow:
                {
                    decimal
                        tmpDecimal = Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, FieldName));

                    Total += tmpDecimal;

                    break;
                }
                }

                break;
            }

            case "GridView2":
            {
                switch (e.Row.RowType)
                {
                case DataControlRowType.Header:
                {
                    Total = 0m;

                    break;
                }

                case DataControlRowType.DataRow:
                {
                    decimal
                        tmpDecimal = !((DataRowView)e.Row.DataItem).Row.IsNull(FieldName) ? Convert.ToDecimal(((DataRowView)e.Row.DataItem).Row[FieldName]) : 0m;

                    //decimal
                    //	tmpDecimal = !(e.Row.DataItem as System.Data.DataRowView).Row.IsNull(FieldName) ? Convert.ToDecimal((e.Row.DataItem as System.Data.DataRowView).Row[FieldName]) : 0m;

                    Total += tmpDecimal;

                    break;
                }

                case DataControlRowType.Footer:
                {
                    e.Row.Cells[0].Text            = "<b>»того:</b>";
                    e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Left;
                    e.Row.Cells[1].Text            = "<b>" + Total.ToString("c") + "</b>";
                    e.Row.Cells[1].HorizontalAlign = HorizontalAlign.Right;

                    break;
                }
                }

                break;
            }
            }
        }
Exemplo n.º 2
0
        protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            string
                tmpString = "GridView_RowCreated(sender.GetType().FullName=\"" + sender.GetType().FullName + "\" e.GetType().FullName=\"" + e.GetType().FullName + "\")";

            if (tmpString != string.Empty)
            {
                LogII.LogII.MakeFile(LogII.LogII.MakeLogFileName(), tmpString, true);
            }

            DataRowView
                tmpDataRowView;

            if ((tmpDataRowView = e.Row.DataItem as DataRowView) != null)
            {
                LogII.LogII.MakeFile(LogII.LogII.MakeLogFileName(), "DataRowView", true);
            }

            DbDataRecord
                tmpDbDataRecord;

            if ((tmpDbDataRecord = e.Row.DataItem as DbDataRecord) != null)
            {
                LogII.LogII.MakeFile(LogII.LogII.MakeLogFileName(), "DbDataRecord", true);
            }
        }