Click here to Skip to main content
12,999,982 members (48,055 online)

Web Development

 
Questionconnecting to Oracle 11g database using PHP Pin
vln1514-Feb-13 0:10
membervln1514-Feb-13 0:10 
QuestionNeed of Online Shopping sourcecode using JSP Pin
Member 981710712-Feb-13 22:04
memberMember 981710712-Feb-13 22:04 
AnswerRe: Need of Online Shopping sourcecode using JSP Pin
Richard MacCutchan12-Feb-13 22:29
mvpRichard MacCutchan12-Feb-13 22:29 
AnswerRe: Need of Online Shopping sourcecode using JSP Pin
Steve Mayfield13-Feb-13 5:51
memberSteve Mayfield13-Feb-13 5:51 
QuestionProposals for a final internship studies Pin
simontifo12-Feb-13 13:31
membersimontifo12-Feb-13 13:31 
AnswerRe: Proposals for a final internship studies Pin
Jibesh12-Feb-13 14:30
memberJibesh12-Feb-13 14:30 
GeneralRe: Proposals for a final internship studies Pin
simontifo28-Feb-13 19:47
membersimontifo28-Feb-13 19:47 
QuestionMVC: Pass List<> between View and Controller Pin
astuserp11-Feb-13 23:05
memberastuserp11-Feb-13 23:05 
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<skill> 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<string> SkillStr = new List<string>();

// 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)

}

Now, the question that I am wondering is why the List<skill> 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.
AnswerRe: MVC: Pass List<> between View and Controller Pin
Bram van Kampen22-Feb-13 15:16
memberBram van Kampen22-Feb-13 15:16 
GeneralRe: MVC: Pass List<> between View and Controller Pin
astuserp24-Feb-13 15:20
memberastuserp24-Feb-13 15:20 
Questionweb development Pin
Durgesh1704r5-Feb-13 1:30
memberDurgesh1704r5-Feb-13 1:30 
AnswerRe: web development Pin
Richard MacCutchan5-Feb-13 1:35
mvpRichard MacCutchan5-Feb-13 1:35 
QuestionRe: web development Pin
Durgesh1704r7-Feb-13 0:55
memberDurgesh1704r7-Feb-13 0:55 
AnswerRe: web development Pin
Richard MacCutchan7-Feb-13 1:32
mvpRichard MacCutchan7-Feb-13 1:32 
AnswerRe: web development Pin
Sandeep Mewara5-Feb-13 2:26
mvpSandeep Mewara5-Feb-13 2:26 
Questionweb development Pin
Durgesh1704r7-Feb-13 0:51
memberDurgesh1704r7-Feb-13 0:51 
AnswerRe: web development Pin
Sandeep Mewara8-Feb-13 3:56
mvpSandeep Mewara8-Feb-13 3:56 
AnswerRe: web development Pin
Rahul Rajat Singh5-Feb-13 19:21
mvpRahul Rajat Singh5-Feb-13 19:21 
Questionweb development Pin
Durgesh1704r7-Feb-13 0:53
memberDurgesh1704r7-Feb-13 0:53 
AnswerRe: web development Pin
Rahul Rajat Singh7-Feb-13 17:35
mvpRahul Rajat Singh7-Feb-13 17:35 
Generalweb development Pin
Durgesh1704r8-Feb-13 0:39
memberDurgesh1704r8-Feb-13 0:39 
QuestionDynamic Website Deployment in IIS 6 Pin
dihnekhs_gr4-Feb-13 3:07
memberdihnekhs_gr4-Feb-13 3:07 
QuestionExport to excel Pin
codeprojectbalaji3-Feb-13 23:03
membercodeprojectbalaji3-Feb-13 23:03 
QuestionDataSet Pin
Abdulla_M3-Feb-13 21:01
memberAbdulla_M3-Feb-13 21:01 
AnswerRe: DataSet Pin
Sandeep Mewara3-Feb-13 21:38
mvpSandeep Mewara3-Feb-13 21:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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
Web02 | 2.8.170624.1 | Last Updated 23 Jun 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid