/// <summary> /// Method that loads data into the GridView based on the DataTable of all /// the items that are in the Database /// </summary> protected void LoadData() { //Setting up the GridView based on the DataTable _itemDataTable = _itemDao.PullAllData(); GrdAdmin.DataSource = _itemDataTable; GrdAdmin.DataBind(); }
protected void BtnFilter_OnClick(object sender, EventArgs e) { //Filtering GridView based on UserName from the text given inside the TextBox LoadData(); _registerTable.DefaultView.RowFilter = $"[UserName] like '%{TxtFilter.Text}%'"; GrdAdmin.DataSource = _registerTable; GrdAdmin.DataBind(); }
protected void GrdAdmin_OnSorting(object sender, GridViewSortEventArgs e) { //Sorting the GridView based on the column the user selected LoadData(); _registerTable.DefaultView.Sort = e.SortExpression; GrdAdmin.DataSource = _registerTable; GrdAdmin.DataBind(); }
protected void GrdCourse_OnSorting(object sender, GridViewSortEventArgs e) { //Load data into the GridView LoadData(); //Sorting the GridView based on the column the user selected _itemDataTable.DefaultView.Sort = e.SortExpression; GrdAdmin.DataSource = _itemDataTable; GrdAdmin.DataBind(); }
/// <summary> /// Method that will read from the registration table and populate the GridView /// with all its information. /// </summary> private void LoadData() { //Setting up the GridView based on the DataTable _registerTable = _registrationDao.PullAllData(); GrdAdmin.DataSource = _registerTable; GrdAdmin.DataBind(); //Looping through each row to setup the dropdown of each request for (var i = 0; i < GrdAdmin.Rows.Count; i++) { var dropDownStatus = (DropDownList)GrdAdmin.Rows[i].FindControl("DrpStatus"); dropDownStatus.DataSource = Enum.GetValues(typeof(Status)); dropDownStatus.DataBind(); dropDownStatus.SelectedIndex = 0; } }