private void InitializeGrid() { // column groups view this.columnGroupsView = new ColumnGroupsViewDefinition(); this.columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup("General")); this.columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup("Details")); this.columnGroupsView.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Address")); this.columnGroupsView.ColumnGroups[1].Groups.Add(new GridViewColumnGroup()); this.columnGroupsView.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow()); this.columnGroupsView.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow()); this.columnGroupsView.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["CustomerID"]); this.columnGroupsView.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactName"]); this.columnGroupsView.ColumnGroups[0].Rows[1].Columns.Add(this.radGridView1.Columns["CompanyName"]); this.columnGroupsView.ColumnGroups[1].Groups[0].Rows.Add(new GridViewColumnGroupRow()); this.columnGroupsView.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["City"]); this.columnGroupsView.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Country"]); this.columnGroupsView.ColumnGroups[1].Groups[1].Rows.Add(new GridViewColumnGroupRow()); this.columnGroupsView.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Phone"]); // html view this.htmlView = new HtmlViewDefinition(); this.htmlView.RowTemplate.Rows.Add(new RowDefinition()); this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("CustomerID")); this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("ContactName")); this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("City")); this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("Country")); this.htmlView.RowTemplate.Rows[0].Cells[2].RowSpan = 2; this.htmlView.RowTemplate.Rows[0].Cells[3].RowSpan = 2; this.htmlView.RowTemplate.Rows.Add(new RowDefinition()); this.htmlView.RowTemplate.Rows[1].Cells.Add(new CellDefinition("CompanyName")); this.htmlView.RowTemplate.Rows[1].Cells[0].ColSpan = 2; }
public void LoadGrid() { if (radGridView1.Relations.Count > 0) { radGridView1.Relations.Clear(); } GridViewRelation relation1 = new GridViewRelation(radGridView1.MasterTemplate) { ChildTemplate = radGridView1.MasterTemplate.Templates[0], RelationName = "FKSymbol" }; relation1.ParentColumnNames.Add("Symbol"); relation1.ChildColumnNames.Add("Symbol"); radGridView1.Relations.Add(relation1); HtmlViewDefinition viewDef = new HtmlViewDefinition(); viewDef.RowTemplate.Rows.Add(new RowDefinition()); viewDef.RowTemplate.Rows.Add(new RowDefinition()); viewDef.RowTemplate.Rows.Add(new RowDefinition()); viewDef.RowTemplate.Rows.Add(new RowDefinition()); viewDef.RowTemplate.Rows.Add(new RowDefinition()); viewDef.RowTemplate.Rows.Add(new RowDefinition()); viewDef.RowTemplate.Rows[0].Cells.Add(new CellDefinition("Time1", 0, 1, 1)); viewDef.RowTemplate.Rows[0].Cells.Add(new CellDefinition("Time", 0, 1, 1)); viewDef.RowTemplate.Rows[1].Cells.Add(new CellDefinition("Open1", 0, 1, 1)); viewDef.RowTemplate.Rows[1].Cells.Add(new CellDefinition("Open", 0, 1, 1)); viewDef.RowTemplate.Rows[2].Cells.Add(new CellDefinition("High1", 0, 1, 1)); viewDef.RowTemplate.Rows[2].Cells.Add(new CellDefinition("High", 0, 1, 1)); viewDef.RowTemplate.Rows[3].Cells.Add(new CellDefinition("Low1", 0, 1, 1)); viewDef.RowTemplate.Rows[3].Cells.Add(new CellDefinition("Low", 0, 1, 1)); viewDef.RowTemplate.Rows[4].Cells.Add(new CellDefinition("Close1", 0, 1, 1)); viewDef.RowTemplate.Rows[4].Cells.Add(new CellDefinition("Close", 0, 1, 1)); viewDef.RowTemplate.Rows[5].Cells.Add(new CellDefinition("Trades1", 0, 1, 1)); viewDef.RowTemplate.Rows[5].Cells.Add(new CellDefinition("Trades", 0, 1, 1)); radGridView1.MasterTemplate.Templates[0].ViewDefinition = viewDef; radGridView1.Columns["Symbol"].MinWidth = 60; radGridView1.Columns["Last"].MinWidth = 50; radGridView1.Columns["Variation"].MinWidth = 50; radGridView1.Columns["Volume"].MinWidth = 60; radGridView1.Columns["Symbol"].TextAlignment = ContentAlignment.TopLeft; radGridView1.Columns["Last"].TextAlignment = ContentAlignment.TopRight; radGridView1.Columns["Variation"].TextAlignment = ContentAlignment.TopRight; radGridView1.Columns["Volume"].TextAlignment = ContentAlignment.TopRight; radGridView1.GridBehavior = new RadGridBehavior(); //Expand rows: if (rowsExpanded.Count > 0 && rowsExpanded.Count == radGridView1.Rows.Count) { for (int i = 0; i < radGridView1.Rows.Count; i++) { radGridView1.Rows[i].IsExpanded = rowsExpanded[i]; } } }
void LoadDetailsTable() { DataTable table = new DataTable("Details"); table.Columns.Add("EmployeeID", typeof(int)); table.Columns.Add("Photo", typeof(byte[])); table.Columns.Add("FirstName", typeof(string)); table.Columns.Add("LastName", typeof(string)); table.Columns.Add("Title", typeof(string)); table.Columns.Add("Address", typeof(string)); table.Columns.Add("City", typeof(string)); table.Columns.Add("BirthDate", typeof(DateTime)); table.Columns.Add("Country", typeof(string)); foreach (DataRow row in this.northwindDataSet.Employees.Rows) { table.Rows.Add(row["EmployeeID"], row["Photo"], row["FirstName"], row["LastName"], row["Title"], row["Address"], row["City"], row["BirthDate"], row["Country"]); } GridViewTemplate template = new GridViewTemplate(); template.Caption = "Details"; template.DataSource = table; template.AllowRowResize = false; template.ShowColumnHeaders = false; template.Columns["Photo"].Width = 125; template.Columns["City"].Width = 70; template.Columns["Country"].Width = 70; template.Columns["FirstName"].DisableHTMLRendering = false; template.Columns["Title"].DisableHTMLRendering = false; template.Columns["BirthDate"].DisableHTMLRendering = false; template.Columns["Address"].Width = 200; template.Columns["Address"].DisableHTMLRendering = false; this.radGridView1.Templates.Insert(0, template); GridViewRelation relation = new GridViewRelation(this.radGridView1.MasterTemplate); relation.ChildTemplate = template; relation.ParentColumnNames.Add("EmployeeID"); relation.ChildColumnNames.Add("EmployeeID"); this.radGridView1.Relations.Add(relation); HtmlViewDefinition viewDef = new HtmlViewDefinition(); viewDef.RowTemplate.Rows.Add(new RowDefinition()); viewDef.RowTemplate.Rows.Add(new RowDefinition()); viewDef.RowTemplate.Rows.Add(new RowDefinition()); viewDef.RowTemplate.Rows[0].Cells.Add(new CellDefinition("Photo", 0, 1, 3)); viewDef.RowTemplate.Rows[0].Cells.Add(new CellDefinition("FirstName", 0, 1, 1)); viewDef.RowTemplate.Rows[0].Cells.Add(new CellDefinition("BirthDate", 0, 2, 1)); viewDef.RowTemplate.Rows[1].Cells.Add(new CellDefinition("Title", 0, 3, 1)); viewDef.RowTemplate.Rows[2].Cells.Add(new CellDefinition("Address", 0, 1, 1)); viewDef.RowTemplate.Rows[2].Cells.Add(new CellDefinition("City", 0, 1, 1)); viewDef.RowTemplate.Rows[2].Cells.Add(new CellDefinition("Country", 0, 1, 1)); template.ViewDefinition = viewDef; }
public frmBorongan() { InitializeComponent(); // html view this.htmlView = new HtmlViewDefinition(); this.htmlView.RowTemplate.Rows.Add(new RowDefinition(25)); this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("Nama")); this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("MulaiBorongan")); this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("SelesaiBorongan")); this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("TipeBorongan")); this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("HasilBorongan")); this.htmlView.RowTemplate.Rows.Add(new RowDefinition(25)); this.htmlView.RowTemplate.Rows[1].Cells.Add(new CellDefinition("JumlahOrang")); this.htmlView.RowTemplate.Rows[1].Cells.Add(new CellDefinition("Jam")); this.htmlView.RowTemplate.Rows[1].Cells[1].ColSpan = 2; this.htmlView.RowTemplate.Rows[1].Cells.Add(new CellDefinition("Pecah")); this.htmlView.RowTemplate.Rows[1].Cells.Add(new CellDefinition("Peti")); this.htmlView.RowTemplate.Rows.Add(new RowDefinition(30)); this.htmlView.RowTemplate.Rows[2].Cells.Add(new CellDefinition("nopeti")); this.htmlView.RowTemplate.Rows[2].Cells[0].ColSpan = 5; this.radGridView1.ViewDefinition = htmlView; //this.radGridView1.Columns["nopeti"]. this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None; this.radGridView1.TableElement.RowSpacing = 5; //default tgl value dtPilihTanggal.Value = DateTime.Now; //Potongan Total Info //Add Total info Hasil Borongan //this.radGridView4.GroupDescriptors[0].Aggregates.Add("sum(iif(trim(tipeborongan) = 'PB',hasilborongan,0))"); //this.radGridView4.GroupDescriptors[0].Aggregates.Add("sum(iif(trim(tipeborongan) = 'LB2',hasilborongan,0))"); //this.radGridView4.GroupDescriptors[0].Aggregates.Add("sum(iif(trim(tipeborongan) = 'LB3',hasilborongan,0))"); //this.radGridView4.GroupDescriptors[0].Aggregates.Add("sum(iif(trim(tipeborongan) = 'LK2',hasilborongan,0))"); //this.radGridView4.GroupDescriptors[0].Aggregates.Add("sum(iif(trim(tipeborongan) = 'LK3',hasilborongan,0))"); //this.radGridView4.GroupDescriptors[0].Aggregates.Add("sum(iif(trim(tipeborongan) = 'TB',hasilborongan,0))"); //this.radGridView4.GroupDescriptors[0].Format = @"{1:dd MMM yyy} [PB - {2:#,###.##}] [LB2 - {3:#,###.##}] [LB3 - {4:#,###.##}] [LK2 - {5:#,###.##}] [LK3 - {6:#,###.##}] [TB - {7:#,###.##}]"; //this.radGridView4.GroupDescriptors[0].Format = @"{1:dd MMM yyy} [PB - {2:}] [LB2 - {3}] [LB3 - {4}] [LK2 - {5}] [LK3 - {6}] [TB - {7}]"; //Add Total Info Potongan this.radGridView5.GroupDescriptors[0].Aggregates.Add("sum(jamhitung * gajiperjam)"); this.radGridView5.GroupDescriptors[0].Format = @"{1} - {2:Rp #,###.00}"; }
public frmPinjaman() { InitializeComponent(); // html view this.htmlView = new HtmlViewDefinition(); this.htmlView.RowTemplate.Rows.Add(new RowDefinition(25)); this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("BuruhID")); this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("TotalPinjaman")); this.htmlView.RowTemplate.Rows.Add(new RowDefinition(25)); this.htmlView.RowTemplate.Rows[1].Cells.Add(new CellDefinition("StartDate")); this.htmlView.RowTemplate.Rows[1].Cells.Add(new CellDefinition("EndDate")); this.htmlView.RowTemplate.Rows.Add(new RowDefinition(25)); this.htmlView.RowTemplate.Rows[2].Cells.Add(new CellDefinition("UnitValue")); this.htmlView.RowTemplate.Rows[2].Cells.Add(new CellDefinition("JumlahAngsuran")); this.htmlView.RowTemplate.Rows.Add(new RowDefinition(25)); this.htmlView.RowTemplate.Rows[3].Cells.Add(new CellDefinition("Bayar")); this.htmlView.RowTemplate.Rows[3].Cells.Add(new CellDefinition("TotalBayar")); this.htmlView.RowTemplate.Rows.Add(new RowDefinition(30)); this.htmlView.RowTemplate.Rows[4].Cells.Add(new CellDefinition("Alasan", 500, 2, 1)); this.radGridView1.ViewDefinition = htmlView; //this.radGridView1.Columns["nopeti"]. this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None; this.radGridView1.TableElement.RowSpacing = 5; this.radGridView1.EnableCustomGrouping = true; this.radGridView1.CustomGrouping += new GridViewCustomGroupingEventHandler(radGridView1_CustomGrouping); GroupDescriptor descriptor = new GroupDescriptor("Active"); this.radGridView1.GroupDescriptors.Add(descriptor); this.radGridView1.GroupDescriptors[0].Aggregates.Add("count(pinjamanid)"); this.radGridView1.GroupSummaryEvaluate += new GroupSummaryEvaluateEventHandler(radGridView1_GroupSummaryEvaluate); }
private void InitializeGrid() { this.radGridView1.Columns["FirstName"].Width = 80; this.radGridView1.Columns["LastName"].Width = 80; this.radGridView1.Columns["Title"].Width = 120; this.radGridView1.Columns["Photo"].Width = 80; this.radGridView1.Columns["Photo"].ImageLayout = ImageLayout.Stretch; this.radGridView1.Columns["City"].Width = 70; this.radGridView1.Columns["Country"].Width = 70; this.radGridView1.Columns["Address"].Width = 200; this.radGridView1.Columns["Notes"].Width = 260; this.radGridView1.Columns["Notes"].WrapText = true; this.radGridView1.Columns["BirthDate"].FormatString = "{0:d}"; this.radGridView1.Columns["BirthDate"].Width = 120; this.radGridView1.Columns["HireDate"].FormatString = "{0:d}"; ((GridViewTextBoxColumn)this.radGridView1.Columns["Notes"]).Multiline = true; tableViewInfo = new ViewDefinitionInfo(); tableViewInfo.ViewDefinition = (TableViewDefinition)this.radGridView1.ViewDefinition; tableViewInfo.Columns = new List <string>() { "FirstName", "LastName", "Title", "Country", "HomePhone", "Address", "Check", "Combo" }; // column groups view ColumnGroupsViewDefinition cgv = new ColumnGroupsViewDefinition(); columnGroupViewInfo = new ViewDefinitionInfo(); columnGroupViewInfo.ViewDefinition = cgv; columnGroupViewInfo.Columns = new List <string>() { "Photo", "FirstName", "LastName", "Title", "Address", "City", "Country", "HomePhone", "Notes" }; columnGroupViewInfo.RowHeight = 90; columnGroupViewInfo.HeaderHeight = 60; cgv.ColumnGroups.Add(new GridViewColumnGroup()); cgv.ColumnGroups.Add(new GridViewColumnGroup("General")); cgv.ColumnGroups.Add(new GridViewColumnGroup("Details")); cgv.ColumnGroups.Add(new GridViewColumnGroup("Notes")); cgv.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow()); cgv.ColumnGroups[1].Rows.Add(new GridViewColumnGroupRow()); cgv.ColumnGroups[1].Rows.Add(new GridViewColumnGroupRow()); cgv.ColumnGroups[2].Rows.Add(new GridViewColumnGroupRow()); cgv.ColumnGroups[2].Rows.Add(new GridViewColumnGroupRow()); cgv.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Photo"]); cgv.ColumnGroups[0].ShowHeader = false; cgv.ColumnGroups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Title"]); cgv.ColumnGroups[1].Rows[1].Columns.Add(this.radGridView1.Columns["FirstName"]); cgv.ColumnGroups[1].Rows[1].Columns.Add(this.radGridView1.Columns["LastName"]); cgv.ColumnGroups[2].Rows[0].Columns.Add(this.radGridView1.Columns["City"]); cgv.ColumnGroups[2].Rows[0].Columns.Add(this.radGridView1.Columns["Country"]); cgv.ColumnGroups[2].Rows[0].Columns.Add(this.radGridView1.Columns["HomePhone"]); cgv.ColumnGroups[2].Rows[1].Columns.Add(this.radGridView1.Columns["Address"]); cgv.ColumnGroups[3].Rows.Add(new GridViewColumnGroupRow()); cgv.ColumnGroups[3].Rows[0].Columns.Add(this.radGridView1.Columns["Notes"]); cgv.ColumnGroups[3].ShowHeader = false; // html view htmlViewInfo = new ViewDefinitionInfo(); htmlViewInfo.ViewDefinition = new HtmlViewDefinition(); htmlViewInfo.Columns = new List <string>() { "Photo", "Title", "FirstName", "LastName", "City", "Country", "Address", "Phone", "BirthDate", "HireDate", "HomePhone" }; HtmlViewDefinition htmlView = new HtmlViewDefinition(); htmlView.RowTemplate.Rows.Add(new RowDefinition()); htmlView.RowTemplate.Rows.Add(new RowDefinition()); htmlView.RowTemplate.Rows.Add(new RowDefinition()); htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("Photo", 0, 1, 3)); htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("FirstName", 0, 1, 1)); htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("LastName", 0, 2, 1)); htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("BirthDate", 0, 1, 1)); htmlView.RowTemplate.Rows[1].Cells.Add(new CellDefinition("Title", 0, 3, 1)); htmlView.RowTemplate.Rows[1].Cells.Add(new CellDefinition("HireDate", 0, 1, 1)); htmlView.RowTemplate.Rows[2].Cells.Add(new CellDefinition("Address", 0, 1, 1)); htmlView.RowTemplate.Rows[2].Cells.Add(new CellDefinition("City", 0, 1, 1)); htmlView.RowTemplate.Rows[2].Cells.Add(new CellDefinition("Country", 0, 1, 1)); htmlView.RowTemplate.Rows[2].Cells.Add(new CellDefinition("HomePhone", 0, 1, 1)); htmlView.RowTemplate.Rows[0].Height = 23; htmlView.RowTemplate.Rows[1].Height = 23; htmlView.RowTemplate.Rows[2].Height = 32; htmlViewInfo.RowHeight = -1; htmlViewInfo.HeaderHeight = -1; htmlViewInfo.ViewDefinition = htmlView; }