Beispiel #1
0
        private void BindDropSearch()
        {
            ddlDepName.DataSource = DepartmentBLL.GetAllDepartment();
            ddlDepName.Items.Insert(0, new ListItem("Select Department", ""));
            ddlDepName.DataTextField  = "Name";
            ddlDepName.DataValueField = "DepId";

            ddlDepName.DataBind();
        }
        private void BindData()
        {
            dgvDepartment.Rows.Clear();
            var depBLL = new DepartmentBLL();
            var result = depBLL.GetAllDepartment();
            int i      = 1;

            foreach (var item in result)
            {
                dgvDepartment.Rows.Add(item.DepartmentID, i++, item.DepartmentName);
            }
        }
 private void BindGrid(bool isSearch)
 {
     //if (ddlDepName.SelectedIndex != -1 && isSearch)
     //{
     //    Department obj = new Department();
     //    obj.DepartmentID = int.Parse(ddlDepName.SelectedValue);
     //    DepartmentBLL depBll = new DepartmentBLL();
     //    ds = depBll.GetById(obj);
     //}
     //else
     {
         ds = DepartmentBLL.GetAllDepartment(connection);
     }
     DepDisplayGrid.DataSource = ds;
     DepDisplayGrid.DataBind();
 }
Beispiel #4
0
        protected void CategoryDisplayGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if ((e.Row.RowState & DataControlRowState.Edit) > 0)
                {
                    try
                    {
                        DropDownList depList = (DropDownList)e.Row.FindControl("ddlDepName");
                        depList.DataSource = DepartmentBLL.GetAllDepartment();
                        depList.DataBind();
                        depList.DataTextField  = "Name";
                        depList.DataValueField = "DepId";
                        depList.DataBind();
                        depList.Items.FindByValue((e.Row.FindControl("lblDep_Id") as Label).Text).Selected = true;

                        DataRowView dr = e.Row.DataItem as DataRowView;
                        depList.SelectedValue = (string)e.Row.DataItem; // you can use e.Row.DataItem to get the value
                    }
                    catch (Exception exo)
                    { }
                }
            }
        }
Beispiel #5
0
        private void BindGrid(bool isSearch)
        {
            if (ddlCatName.SelectedIndex != -1 && isSearch)
            {
                Category obj = new Category();
                obj.CategoryID = int.Parse(ddlCatName.SelectedValue);
                CategoryBLL ins = new CategoryBLL();
                ds = ins.GetById(obj);
            }
            else
            {
                ds = CategoryBLL.GetAllCategories();
            }
            CategoryDisplayGrid.DataSource = ds;
            CategoryDisplayGrid.DataBind();

            DropDownList depList = (DropDownList)CategoryDisplayGrid.FooterRow.FindControl("ddlAddDepName");

            depList.DataSource = DepartmentBLL.GetAllDepartment();
            depList.DataBind();
            depList.DataTextField  = "Name";
            depList.DataValueField = "DepId";
            depList.DataBind();
        }
Beispiel #6
0
 private void GetAllDepartment()
 {
     departmentGridView.DataSource = aDepartmentBll.GetAllDepartment();
 }