public ActionResult Index(string ddlUsers, string txtDate) { string role = roledb.GetUserRolesByUser(User.Identity.Name.ToString().ToUpper().Replace("CT\\", "")); ViewData["Role"] = role; DateTime myDate = DateTime.Now; if (txtDate != null) { myDate = DateTime.Parse(txtDate); } string User_CAI = ""; if (ddlUsers == null) { User_CAI = User.Identity.Name.ToUpper().Replace("CT\\", ""); } // User_CAI = "PALX"; else { User_CAI = ddlUsers; } var users = new SelectList(userdb.GetUserItems(), "cai", "detail", User_CAI); var UserProjects = userdb.GetUserResources(User_CAI).ToList(); var timesheets = timedb.GetTimeSheetByUser(User_CAI, myDate); ViewData["Users"] = users; // ViewData["MonthDays"] = MonthDays(myDate); ViewData["UserProjects"] = UserProjects; return(View(timesheets)); }