Пример #1
0
        private void GridEX1_CurrentLayoutChanged(object sender, EventArgs e)
        {
            //clear the DataTable used by the previous layout
            jsNorthWindDataSet1.Clear();

            //When layouts are persisted into a file,
            //the DataSource and DataMember properties are
            //not persisted so you must reset them at run time
            //instead of resseting the DataSource and DataMember
            //properties when the layout is made, this could be done
            //in all the layouts at once in the LayoutLoad event
            if (GridEX1.CurrentLayout != null)
            {
                switch (GridEX1.CurrentLayout.Key)
                {
                case "Customers":
                    customersTableAdapter1.Fill(jsNorthWindDataSet1.Customers);
                    GridEX1.SetDataBinding(jsNorthWindDataSet1, "Customers");
                    break;

                case "Products":
                    productsTableAdapter1.Fill(jsNorthWindDataSet1.Products);
                    GridEX1.SetDataBinding(jsNorthWindDataSet1, "Products");
                    break;

                case "Suppliers":
                    suppliersTableAdapter1.Fill(jsNorthWindDataSet1.Suppliers);
                    GridEX1.SetDataBinding(jsNorthWindDataSet1, "Suppliers");
                    break;
                }
            }
        }
Пример #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            //Creating the collection
            people = new PersonCollection();
            people.Add(new Person("Mr.", "John", "Smith", "Sr."));
            people.Add(new Person("Mrs.", "Mary", "Jones", ""));
            people.Add(new Person("Miss", "Sally", "Porter", ""));
            people.Add(new Person("Mr.", "Joseph", "Gold", "Jr."));
            people.Add(new Person("Dr.", "Ian", "Goldsmith", ""));

            //Binding GridEX to the people collection
            GridEX1.SetDataBinding(people, "");
            //Forcing GridEX control to generate the columns needed
            //to display all the properties in the Person class.
            GridEX1.RetrieveStructure();
        }
Пример #3
0
		private void CreateDataSourceAndBindGrid()
		{
			gridDataSource = new DataSet();
			DataTable dataTable = new DataTable("Tasks");
			DataColumn column = dataTable.Columns.Add("Id", typeof(int));
			column.AutoIncrement = true;
			dataTable.Columns.Add("Subject", typeof(string));
			dataTable.Columns.Add("Complete", typeof(bool));
			dataTable.Columns.Add("DueDate", typeof(DateTime));

			//add datatable to dataset
			gridDataSource.Tables.Add(dataTable);
			//adding some sample rows
			dataTable.Rows.Add(1, "Task 1", false, DateTime.Today.AddDays(2));
			dataTable.Rows.Add(2, "Task 2", true, DateTime.Today);

			//bind grid to the datasource
			GridEX1.SetDataBinding(gridDataSource, "Tasks");

		}
Пример #4
0
        private void BindGridEXControl()
        {
            DataSet   ds    = new DataSet();
            DataTable table = new DataTable("Messages");

            table.Columns.Add(new DataColumn("From", typeof(string)));
            table.Columns.Add(new DataColumn("Subject", typeof(string)));
            table.Columns.Add(new DataColumn("Date", typeof(DateTime)));

            ds.Tables.Add(table);

            table.Rows.Add("*****@*****.**", "Greetings", new DateTime(2002, 2, 5));
            table.Rows.Add("*****@*****.**", "Invitation", new DateTime(2002, 2, 7));
            table.Rows.Add("*****@*****.**", "A question", new DateTime(2002, 2, 10));
            table.Rows.Add("*****@*****.**", "How are you?", new DateTime(2002, 2, 12));
            table.Rows.Add("*****@*****.**", "Greetings", new DateTime(2002, 2, 14));
            table.Rows.Add("*****@*****.**", "Hi", new DateTime(2002, 2, 18));
            table.Rows.Add("*****@*****.**", "No Subject", new DateTime(2002, 2, 20));
            GridEX1.SetDataBinding(ds, "Messages");
        }