您的位置:首页 > 其它

UltraWebGrid中格式化字符串

2009-03-01 18:01 274 查看
internal void UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)
        {
            // Allow for deletion 
            e.Layout.AllowDeleteDefault = AllowDelete.Yes;
            // allow update for the WebGrid
            e.Layout.AllowUpdateDefault = AllowUpdate.Yes;
                
            UltraGridColumn c;
            
            // formats the Date column
            e.Layout.Bands[0].Columns.FromKey("Date").Format = "MM/dd/yyyy";
            // Sets up the format for the Received column
            c = e.Layout.Bands[0].Columns.FromKey("Received");
            c.Format = "$###,###.00";
            c.CellStyle.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
            c.CellStyle.HorizontalAlign =  HorizontalAlign.Right;
            c.DefaultValue = 0;
            // Sets up the format for the payment column
            c = e.Layout.Bands[0].Columns.FromKey("Payment");
            c.Format = "$###,###.00";
            //c.CellStyle.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(128)));
            c.CellStyle.BackColor = System.Drawing.Color.LightYellow;
            c.CellStyle.HorizontalAlign =  HorizontalAlign.Right;
            c.DefaultValue = 0;
            // Adds an unbound column for the description field and moves it into the 2nd column slot
            e.Layout.Bands[0].Columns.Add("Description", "Description");            
            c = e.Layout.Bands[0].Columns.FromKey("Description");
            c.Move(1);
            // Adds an unbound column to act as a summary column
            e.Layout.Bands[0].Columns.Add("Balance","Balance");
            c = e.Layout.Bands[0].Columns.FromKey("Balance");
            c.Format = "$###,###.00";
            c.CellStyle.BackColor = System.Drawing.Color.LightSteelBlue;
            c.CellStyle.HorizontalAlign =  HorizontalAlign.Right;
            // turn off editing of the last column
            c.AllowUpdate = AllowUpdate.No;
        
            // sets up the backcolor on the lables
            this.ulCurrentBalance.BackColor = Color.LightSteelBlue;
            this.ulPayable.BackColor = Color.LightYellow;
            this.ulReceivable.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
        }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: