Esempio n. 1
0
        protected void SetupDropDownLists()
        {
            rddlOffice.DataSource = db.Offices.Where(p => p.wsc_id == WSCID).ToList();
            rddlOffice.DataBind();
            rddlOffice.SelectedValue = OfficeID.ToString();
            SelOffice = db.Offices.Where(p => p.office_id == Convert.ToInt32(rddlOffice.SelectedValue)).FirstOrDefault();

            rddlFieldTrip.DataSource = db.Trips.Where(p => p.office_id == OfficeID).Select(p => new { trip_id = p.trip_id, TripName = p.trip_nm + " (" + p.user_id + ")" }).OrderBy(p => p.TripName).ToList();
            rddlFieldTrip.DataBind();
            rddlFieldTrip.Items.Add(new DropDownListItem {
                Value = "", Text = ""
            });
            if (TripID > 0)
            {
                rddlFieldTrip.SelectedValue = TripID.ToString();
            }
            else
            {
                rddlFieldTrip.SelectedValue = "";
            }
            if (TripID > 0)
            {
                SelTrip = db.Trips.Where(p => p.trip_id == Convert.ToInt32(rddlFieldTrip.SelectedValue)).FirstOrDefault();
            }
        }
Esempio n. 2
0
 public void FormControls(string CLR)
 {
     if (CLR == "CLR")
     {
         OfficeID.Clear();
         OWorkerName.Clear();
         Officeaddress.Clear();
         Officecity.Clear();
         Officecontact.Clear();
         OfficeID.Enabled      = false;
         OWorkerName.Enabled   = false;
         Officeaddress.Enabled = false;
         Officecity.Enabled    = false;
         Officecontact.Enabled = false;
         btnsave.Enabled       = false;
         btnedit.Enabled       = false;
         btndelete.Enabled     = false;
         btnadd.Enabled        = true;
         btnfind.Enabled       = true;
         Left1.Enabled         = false;
         Right1.Enabled        = false;
     }
     if (CLR == "Save")
     {
         btnsave.Enabled       = true;
         btnadd.Enabled        = false;
         btnfind.Enabled       = false;
         btndelete.Enabled     = false;
         btnedit.Enabled       = false;
         OWorkerName.Enabled   = true;
         Officeaddress.Enabled = true;
         Officecity.Enabled    = true;
         Officecontact.Enabled = true;
         OWorkerName.Focus();
     }
 }