我正在从互联网学习MVC并开发一个项目。我有一个动作方法ViewProfile(int id)in controller.When i called this action from view
@ Html.ActionLink(item.RegID," ViewProfile",&#34 ; UserDetails",new {id = item.PersonalID},null)
then view is displayed without images and js are not working.But when i make action ViewProfile without parameter then it works fine when i call it from view
@ Html.ActionLink(item.RegID," ViewProfile"," UserDetails")它工作正常。
public ActionResult ViewProfile(int id)
{
var result = from m in db.PersonalDetails
join d in db.HoroscopeDetails on m.PersonalID equals d.PersonalID
join b in db.AddressDetails on m.PersonalID equals b.PersonalID
join f in db.FamilyDetails on m.PersonalID equals f.PersonalID
join ed in db.EducationalDetails on m.PersonalID equals ed.PersonalID
join exp in db.Expectations on m.PersonalID equals exp.PersonalID
where m.PersonalID == id
select new EditModel
{
PersonalID = m.PersonalID,
BloodGroup = m.BloodGroup,
Complexion = m.Complexion,
Diet = m.Diet,
Disability = m.Disability,
DisabilityDetails = m.DisabilityDetails,
DOB = m.DOB,
FirstName = m.FirstName,
Height = m.Height,
LastName = m.LastName,
Lens = m.Lens,
MaritalStatus = m.MaritalStatus,
MidName = m.MidName,
Personality = m.Personality,
ProfilePic = m.ProfilePic,
Spectacles = m.Spectacles,
subcast = m.subcast,
Weight = m.Weight,
BirthPlace = d.BirthPlace,
BirthTime = d.BirthTime,
Charan = d.Charan,
Gan = d.Gan,
GotraORDevak = d.GotraORDevak,
Mangal = d.Mangal,
Nadi = d.Nadi,
Nakshtra = d.Nakshtra,
Rashi = d.Rashi,
Mobile1 = b.Mobile1,
EmailId = b.EmailId,
FullAddress = b.FullAddress,
Mobile2 = b.Mobile2,
Phone1 = b.Phone1,
Phone2 = b.Phone2,
PinCode = b.PinCode,
Brother = f.Brother,
FamilyEstate = f.FamilyEstate,
Father = f.Father,
FatherFullName = f.FatherFullName,
InterCast = f.InterCast,
IntercastAny = f.IntercastAny,
MamasName = f.MamasName,
MarriedBrother = f.MarriedBrother,
MarriedSister = f.MarriedSister,
Mother = f.Mother,
NativeDistrict = f.NativeDistrict,
ParentCity = f.ParentCity,
ParentOccupation = f.ParentOccupation,
Relatives = f.Relatives,
Sister = f.Sister,
Education = ed.Education,
EducationDetails = ed.EducationDetails,
Income = ed.Income,
IncomeType = ed.IncomeType,
Occupation = ed.Occupation,
OccupationCity = ed.OccupationCity,
Divorcee = exp.Divorcee,
expEducation = exp.Education,
ExpectedCast = exp.ExpectedCast,
ExpHeight = exp.ExpHeight,
ExpOccupationIncome = exp.ExpOccupationIncome,
Mangalik = exp.Mangal,
MaxAgeDiff = exp.MaxAgeDiff,
PreferCity = exp.PreferCity,
taluka = f.Taluka,
};
ViewBag.List = result;
return View("ViewDetails");
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}