我有一个奇怪的问题,过去几个小时让我很沮丧.我似乎找不到任何相关的东西; 也许我不够具体,因为我不确定如何正确地说出来,或者这是一个奇怪的独特问题.
有一个用户填写的表单来更新他们的帐户信息,一切正常,除了一个文本区域.这个文本区域(被绑定到的属性Comments的UserInfo,一旦表单被提交)值变为零.该Comments属性是唯一的null属性.
何时发生
A)没有现有值,用户输入值,属性为空.
B)现有价值,用户做/不改变什么/什么,属性为空.
我只会包含相关代码以保持简洁.希望这就够了.
控制器动作
public ActionResult Edit_Information(long id)
{
// Get user info from the database.
// Return the view with the user info from the DB etc.
}
[HttpPost]
public ActionResult Edit_Information(long id, UserInfo userInfo)
{
if (!this.ModelState.IsValid)
{
// Invalid
return View(userInfo);
}
// Update the information in the DB.
// Redirect the user back to their account.
}
Run Code Online (Sandbox Code Playgroud)
Razor查看HTML
<div style="width: 700px; margin-left: auto; margin-right: auto; text-align: …Run Code Online (Sandbox Code Playgroud) 当我使用SQL Server 2008时,我不小心对SQL服务器主数据库运行了很多脚本.
这可能有问题吗?这样做会产生哪些问题?
刚开始使用MVC,我遇到了问题.以下是我的文件的层次结构:
1.WebJltNZ\JWebJltNZ.Presentation.Web.Mvc\Controllers : LbpProfessionalController
2.WebJltNZ.Presentation.Web.Mvc\ViewModels : LbpProfessional
3.WebJltNZ.Presentation.Web.Mvc\Views\Home\RiskAndInsuranceServices\JltAffinityPartnerships :LbpProfessionalProtectionApplication
Run Code Online (Sandbox Code Playgroud)
方法如下:
public ActionResult Index()
{
return View(); // it's cannot be found.
}
Run Code Online (Sandbox Code Playgroud)
无法找到该视图.
我在这里错过了一些东西.请帮忙.