我使用 mvc3 有以下情景:
我有一个数据库表格, 包含一个记录ID、 记录Name 和记录类型。 显示为三个文本框, 每个前述字段都显示一个 。
我的问题是,当我在相关文本框中输入音频ID时,我想能够显示该特定音频ID的录音Name和音频Type。我如何才能做到这一点?
我使用 mvc3 有以下情景:
我有一个数据库表格, 包含一个记录ID、 记录Name 和记录类型。 显示为三个文本框, 每个前述字段都显示一个 。
我的问题是,当我在相关文本框中输入音频ID时,我想能够显示该特定音频ID的录音Name和音频Type。我如何才能做到这一点?
视图 :
@Html.TextBoxFor(model => model.RecordId)
@Html.TextBoxFor(model => model.RecordName)
@Html.TextBoxFor(model => model.RecordType)
<script language="javascript">
$( #RecordId ).change(function(){
var recordId = this.value;
$.getJSON("/MyController/GetRecordById",
{
id: recordId
},
function (data) {
$( RecordName ).val(data.Name);
$( RecordType ).val(data.Type);
});
});
</script>
主计长:
public JsonResult GetRecordById(int id)
{
var record = recordRepository.GetById(id);
var result = new {
Name = record.Name,
Type = record.Type
}
return Json(result, JsonRequestBehavior.AllowGet);
}
For a simple application that use asp.net mvc 3 and .net-4, what service locator application is preferred, with performance concern in mind?
Now that MVC 3 Preview 1 here, we can use Razor (.cshtml) view engine. If a view not found, I get this error: The view a or its master was not found. The following locations were searched: ~/Views/...
How to import a namespace in Razor View Page?
I need to render a partial view (returned from the controller) to show some customer summary details. This will need to happen when the user clicks on a button. In the the mean time the user can ...
MVC 2 我们可以轻松地创造领域。 现在,我的问题涉及nes地区(地区内)。
Update after Bounty was awarded A new solution is coming up to this problem. Please refer to ASP.NET MVC 3 Preview 1 here: http://weblogs.asp.net/scottgu/archive/2010/07/27/introducing-asp-net-mvc-3-...
Using a resx file in the App_GlobalResources directory, I ve been able to change the default message for the PropertyValueInvalid string of the model validators. But it doesn t work to translate the ...
I know a bunch of people that are really enjoying the improvements that ASP.NET MVC 2 made over the first release. I have just started to migrate our MVC 1 project over and so far areas has totally ...