我有一个页面,产品出现在右侧,用户可以添加注释 ,所以我有一个用户控件,它获取所有评论和一个小文本区域,其中用户可以添加 该产品的新评论。asp.net mvc表单添加注释
页面的链接就像是
http://localhost/Product/TestComment/1
其中1表示产品的ID和我一直在硬编码我AddNote功能如下 ,你会看到已经硬编码的第四个参数,但我需要通过该产品的编号为 。我该怎么做
AddNote(HttpContext.User.Identity.ToString(),txtComment,1, DateTime.Now,true);
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult AddComment(string txtComment)
{
bool rst = _NotesService.AddNote(HttpContext.User.Identity.ToString(), txtComment, 1, DateTime.Now, true);
return RedirectToAction("TestComment");
}
我需要MVC 2吗? – Pinu 2010-05-03 15:41:40
是的,对于HiddenFor,但你不必使用HiddenFor,你可以使用Html.Hidden()。 – mare 2010-05-03 16:01:22