/*protected void grdDevices_OnRowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch(e.CommandName.ToUpper()){
                case "EDIT":

                break;
            }
        }*/
        protected void grdDevices_PreRender(object sender, EventArgs e)
        {
            if (grdDevices.EditIndex != -1)
               {
               int rowindex = grdDevices.EditIndex;
               GridViewRow row = grdDevices.Rows[rowindex];

               DropDownList drpCell = (DropDownList)row.FindControl("drpCell");
               DropDownList drpType = (DropDownList)row.FindControl("drpType");
               DropDownList drpBrand = (DropDownList)row.FindControl("drpBrand");

               CellDa celDa = new CellDa();
               drpCell.DataSource = celDa.GetCells();
               drpCell.DataBind();

               TypeDa typeDa = new TypeDa();
               drpType.DataSource = typeDa.GetTypes();
               drpType.DataBind();

               BrandDa brandDa = new BrandDa();
               drpBrand.DataSource = brandDa.GetBrands();
               drpBrand.DataBind();
               }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                loadData(DateTime.Now);

                //Fill Dropdowns
                List<EnumSchedule> lstSchedule = new List<EnumSchedule>();
                drpSchedule.DataSource = Enum.GetValues(typeof(EnumSchedule.Task)).Cast<EnumSchedule.Task>().ToList();
                drpSchedule.DataBind();

                CellDa cellDa = new CellDa();
                rptCells.DataSource = cellDa.GetCells();
                rptCells.DataBind();

                renderWeek(DateTime.Now);

                btnAdd.Visible = false;
                btnSave.Visible = false;
            }

            if (Request.Form["__EVENTTARGET"] != null && Request.Form["__EVENTTARGET"] == "btnShowDevices_OnClick")
            {
                int taskId;
                if (int.TryParse(Request.Form["__EVENTARGUMENT"],out taskId))
                {
                    btnShowDevices_OnClick(taskId);
                }
            }
        }