Hidistro.UI.Common.Controls/MoneyColumnForAdmin.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace Hidistro.UI.Common.Controls
{
    using System;
    using System.Globalization;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class MoneyColumnForAdmin : BoundField
    {
        private string remarkText = string.Empty;

        private void cell_DataBinding(object sender, EventArgs e)
        {
            TableCell cell = (TableCell) sender;
            GridViewRow namingContainer = (GridViewRow) cell.NamingContainer;
            try
            {
                cell.Controls.Clear();
                object obj2 = DataBinder.Eval(namingContainer.DataItem, this.DataField);
                cell.Text = ((obj2 == null) || (obj2 == DBNull.Value)) ? this.NullDisplayText : Convert.ToDecimal(obj2).ToString("F", CultureInfo.InvariantCulture);
                if (cell.Text == "")
                {
                    cell.Text = "-";
                }
                if (!string.IsNullOrEmpty(this.RemarkText))
                {
                    cell.Text = this.RemarkText + cell.Text;
                }
            }
            catch
            {
                throw new Exception("Specified DataField was not found.");
            }
        }

        private void EditDataBinding(object sender, EventArgs e)
        {
            TableCell cell = (TableCell) sender;
            GridViewRow namingContainer = (GridViewRow) cell.NamingContainer;
            try
            {
                cell.Controls.Clear();
                object obj2 = DataBinder.Eval(namingContainer.DataItem, this.DataField);
                TextBox child = new TextBox {
                    ID = this.EditTextBoxId,
                    Width = Unit.Percentage(100.0),
                    Text = ((obj2 == null) || (obj2 == DBNull.Value)) ? "" : string.Format("{0:F}", obj2)
                };
                cell.Controls.Add(child);
            }
            catch
            {
                throw new Exception("Specified DataField was not found.");
            }
        }

        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);
            if (cell == null)
后面还有 74 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。