Click here to Skip to main content
       

Web Development

 
Questionconnecting to Oracle 11g database using PHP Pinmembervln1514-Feb-13 0:10 
QuestionNeed of Online Shopping sourcecode using JSP PinmemberMember 981710712-Feb-13 22:04 
AnswerRe: Need of Online Shopping sourcecode using JSP PinmvpRichard MacCutchan12-Feb-13 22:29 
AnswerRe: Need of Online Shopping sourcecode using JSP PinmemberSteve Mayfield13-Feb-13 5:51 
QuestionProposals for a final internship studies Pinmembersimontifo12-Feb-13 13:31 
AnswerRe: Proposals for a final internship studies PinmemberJibesh12-Feb-13 14:30 
GeneralRe: Proposals for a final internship studies Pinmembersimontifo28-Feb-13 19:47 
QuestionMVC: Pass List<> between View and Controller Pinmemberastuserp11-Feb-13 23:05 
}
 
Now, the question that I am wondering is why the List skills become null when it returns from the view, while it was passed with value before the view is shown.
 
Does anyone have any clue what I am missing? I really can not figure out why.
Thank you for any enlightenment that you may provide.
Dear Fellow developer. I am a newbie in MVC. Recently I try to perform the following:
 
//--- Model
public class Skill
{
public bool IsSkill { get; set; }
public string SkillStr { get; set; }
}
 
public class PageModel
{
public string UserName { get; set; }
public string Address { get; set; }
public List skills { get; set; }
}
 
//---Controller
public ViewResult UpdateSkills(int id)
{
PageModel model = GetPageModel(id);
model.skills = GetSkills(id);
return View(model);
}
 
[HttpPost]
public ActionResult UpdateSkills(PageModel model)
{
if (ModelState.IsValid)
{
List SkillStr = new List();
 
// ERROR: model.skills null
foreach (Skill rw in model.skills)
{
if (rw.IsSkill)
{
SkillStr.Add(rw.SkillStr);
}
}
}
// ... Other code are omitted
}
 

//--- View
<!-- Other are omitted --!>
 
@foreach(Skill rw in Model.skills)
{
@Html.EditorFor(m => rw.IsSkill) @Html.DisplayFor(m => rw.SkillStr)
AnswerRe: MVC: Pass List<> between View and Controller PinmemberBram van Kampen22-Feb-13 15:16 
GeneralRe: MVC: Pass List<> between View and Controller Pinmemberastuserp24-Feb-13 15:20 
Questionweb development PinmemberDurgesh1704r5-Feb-13 1:30 
AnswerRe: web development PinmvpRichard MacCutchan5-Feb-13 1:35 
QuestionRe: web development PinmemberDurgesh1704r7-Feb-13 0:55 
AnswerRe: web development PinmvpRichard MacCutchan7-Feb-13 1:32 
AnswerRe: web development PinmvpSandeep Mewara5-Feb-13 2:26 
Questionweb development PinmemberDurgesh1704r7-Feb-13 0:51 
AnswerRe: web development PinmvpSandeep Mewara8-Feb-13 3:56 
AnswerRe: web development PinmvpRahul Rajat Singh5-Feb-13 19:21 
Questionweb development PinmemberDurgesh1704r7-Feb-13 0:53 
AnswerRe: web development PinmvpRahul Rajat Singh7-Feb-13 17:35 
Generalweb development PinmemberDurgesh1704r8-Feb-13 0:39 
QuestionDynamic Website Deployment in IIS 6 Pinmemberdihnekhs_gr4-Feb-13 3:07 
QuestionExport to excel Pinmembercodeprojectbalaji3-Feb-13 23:03 
QuestionDataSet PinmemberAbdulla_M3-Feb-13 21:01 
AnswerRe: DataSet PinmvpSandeep Mewara3-Feb-13 21:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 20 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid