public ActionResult SaveUser() { UserData objuser = new UserData(); var Roleslst = context.SpgetRolelist().ToList().Select(xx => new SelectListItem { Value = xx.RoleName.ToString(), Text = xx.RoleName }).ToList(); ViewData["Roles"] = Roleslst; if (Request.QueryString["Userid"] != null) { Guid newid = new Guid(Request.QueryString["Userid"]); MembershipUser u = Membership.GetUser(newid); if (u != null) { objuser.UserId = u.ProviderUserKey.ToString(); objuser.name = u.UserName; objuser.Email = u.Email; objuser.IsApproved = u.IsApproved; objuser.IsLockedOut = u.IsLockedOut; objuser.Roles = Roles.GetRolesForUser(u.UserName); objuser.RoleSaved = string.Join(",", objuser.Roles); } } if (TempData["Message"] != null) { ViewBag.message = TempData["Message"]; } return(View(objuser)); }