예제 #1
0
    public void setdepartment()
    {
        DBFunctions db = new DBFunctions();

        DeptList.DataSource     = db.getalldepartments();
        DeptList.DataTextField  = "Department";
        DeptList.DataValueField = "ID";
        DeptList.DataBind();
    }
예제 #2
0
        protected void populateDeptList()
        {
            string    getDeptsQuery = DataProvider.DiscDeptWard.getDepartments();
            DataTable dt            = HospitalClass.getDataTable(getDeptsQuery);

            DeptList.DataSource    = dt;
            DeptList.DataTextField = "DEPT_NAME";
            DeptList.DataBind();
            DeptList.Items.Insert(0, new ListItem("Please select..."));
        }
    private void PopulateDropdown()
    {
        var           connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["developmentserver"].ConnectionString;
        SqlConnection conn             = new SqlConnection(connectionString);

        conn.Open();
        SqlCommand    fetchCommand = new SqlCommand("Select * from DEPT", conn);
        SqlDataReader reader       = fetchCommand.ExecuteReader();

        DeptList.DataSource     = reader;
        DeptList.DataTextField  = "DNAME";
        DeptList.DataValueField = "DEPTNO";
        DeptList.DataBind();
        PopulateGrid(this, null);
    }
 protected void deptdatafilter()
 {
     if (EntiyList.SelectedValue != null && EntiyList.SelectedIndex != 0)
     {
         DeptList.Enabled        = true;
         Edit_Entity_btn.Enabled = true;
         DeptList.DataSource     = deptds(Convert.ToInt16(EntiyList.SelectedValue.ToString()));
         DeptList.DataValueField = "ID";
         DeptList.DataTextField  = "Department Name";
         DeptList.DataBind();
         DeptList.Items.Insert(0, "Select the Department");
     }
     else
     {
         DeptList.Enabled        = false;
         Edit_Entity_btn.Enabled = false;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                using (LastADEntities b = new LastADEntities())
                {
                    //To generate data for DropDownList1
                    var itemcat = (from ic in b.ItemCategories select ic.CategoryName).ToList();
                    itemcat.Insert(0, "---Select---");
                    //DropDownList1.SelectedIndex = 0;

                    DropDownList1.DataSource = itemcat;
                    DropDownList1.DataBind();
                    //To generate the options for departments
                    var depts = from dept in b.Departments select dept.DepartmentName;
                    DeptList.DataSource = depts.ToArray();

                    DeptList.DataBind();
                    DeptList.Items.Remove(DeptList.Items.FindByText("Stationary Store Dept"));
                }
            }
        }