public ActionResult EditView() { if (Session["UserSession"] != null) { List <UserInfoDesignationViewModel> userList = _userInfoManger.GetAllUser(); return(View(userList)); } else { return(RedirectToAction("Logout", "Home", new { message = "You have already logged out. Please login again" })); } }
protected void Page_Load(object sender, EventArgs e) { try { Id = int.Parse(Request.QueryString["Id"].ToString()); } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('没有找到任务编号!');", true); return; } //先给Page_load再加载页面绑定的ddl数据 ddlLeader.DataSourceID = null; ddlLeader.DataSource = taskManager.GetAllDepartment(); ddlLeader.DataTextField = "DepartmentName"; ddlLeader.DataValueField = "id"; ddlLeader.DataBind(); ddlFenguanLeder.DataSourceID = null; ddlFenguanLeder.DataSource = taskManager.GetAllTaskLeaders(); ddlFenguanLeder.DataTextField = "name"; ddlFenguanLeder.DataValueField = "uid"; ddlLeader.DataBind(); ddlLeaderMan.DataSourceID = null; ddlLeaderMan.DataSource = taskManager.GetAllTaskLeaders(); ddlLeaderMan.DataTextField = "name"; ddlLeaderMan.DataValueField = "uid"; ddlLeaderMan.DataBind(); ddlPutDepart.DataSourceID = null; ddlPutDepart.DataSource = taskManager.GetAllDepartment(); ddlPutDepart.DataTextField = "DepartmentName"; ddlPutDepart.DataValueField = "id"; ddlPutDepart.DataBind(); ddlweihuMan.DataSourceID = null; ddlweihuMan.DataSource = UserInfoManager.GetAllUser(); ddlweihuMan.DataTextField = "name"; ddlweihuMan.DataValueField = "uid"; ddlweihuMan.DataBind(); //ddlweihuMan.DataSource = taskManager.GetAllUsersByDepartmentId(); t = taskManager.GetTaskByTaskId(Id); this.txtTitle.Text = t.Title; this.ddlweihuMan.SelectedItem.Text = t.Branch; this.txtLingyu.Text = t.Domain; this.ddlLeader.SelectedItem.Text = t.dutyDepart; this.ddlFenguanLeder.SelectedItem.Text = t.Extrleader; this.txFDate.Text = t.filishTime.ToShortDateString(); this.txtMoney0.Text = t.Money.ToString().Substring(0, t.Money.ToString().IndexOf('.')); this.txtMoney.Text = t.Money.ToString().Substring(0, t.Money.ToString().IndexOf('.')); this.txtTargeCode.Text = t.Mumber.ToString(); this.ddlLeaderMan.SelectedItem.Text = t.Principal.ToString(); this.txtMarks.Text = t.Remarks; this.txtTraget.Text = t.targetTask; ddlSteps.SelectedItem.Text = t.Tasktype; this.ddlAddPower.SelectedItem.Text = t.Vindicator; this.txtUserfulWork.Text = t.Work; ddlYears.SelectedValue = t.Year.ToString(); this.Label1.Text = Id.ToString(); hkdown.NavigateUrl = t.Path; }