Skip to main content
 首页 » 编程设计

c#之表单发布发布空

2024年02月13日14think

我试图从表单中发布一些信息,但它一直向 Comment Controller 发布空值,而不是在页面上输入的内容....

@using (Html.BeginForm("SubmitComment", "Comment",FormMethod.Post)) 
{ 
     <fieldset> 
        <legend>Submit a comment</legend> 
        <input id="comment" type="text" /> 
 
        <button type="submit">Submit</button> 
 
    </fieldset> 
} 

有什么想法吗?

请您参考如下方法:

将 name="comment" 属性添加到输入。