0

我有这个:

@Html.Action("CheckForModifyPost", "Forums", new { postAuthor = item.Author.UserName, dateCreated = item.DateCreated})

我得到以下错误:

传入字典的模型项为空,但此字典需要“System.Int32”类型的非空模型项。

两者item.Author.UserNameitem.DateCreated都不为空,我所知道的是这与item.DateCreated. 我该如何解决这个错误?

4

1 回答 1

0
suppose your controller is as follow

ForumController.cs
[httpGet]
public void CheckForModifyPost(string postAuthor, DateTime dateCreated )
{
  YOUR CODE GOES HERE
}



@Html.Action("CheckForModifyPost", "Forums", new { postAuthor = item.Author.UserName, dateCreated = item.DateCreated})



so in @html.Action pass the value with same name as in your action method like if in action method "postAuthor" as argument than in @html.Action pass the value of that argument with same name as in action method means use "postAuthor" in your @html.Action,
if their is only one character different than error occure 
于 2013-02-02T10:24:41.017 回答