// Populate the GridView with data private void BindGrid() { // Get a DataTable object containing the catalog departments grid.DataSource = CatalogBLO.GetDepartments(); // Bind the data bound controls to the data source grid.DataBind(); }
// Load department details into the DataList protected void Page_Load(object sender, EventArgs e) { // don't reload data during postbacks if (!IsPostBack) { // CatalogAccess.GetDepartments returns a DataTable object containing // department data, which is read in the ItemTemplate of the DataList list.DataSource = CatalogBLO.GetDepartments(); // Needed to bind the data bound controls to the data source list.DataBind(); } }