是否可以只接受嵌套视图模型中的回发值?
例如,我只想发布'地址':
Run Code Online (Sandbox Code Playgroud)@Html.TextBoxFor(p => p.User.Account.Address.Street)
@Html.ValidationMessageFor(p => p.User.Account.Address.Street)
对于此控制器操作:Run Code Online (Sandbox Code Playgroud)
目前,如果我将Address传递给它自己的局部视图,那么这些值只会回发,以便属性如下所示:[HttpPost]
public ActionResult SaveAddress(Address address) {
// save to db here
}
@Html.TextBoxFor(p => p.Street)
@Html.ValidationMessageFor(p => p.Street)
当您选择下一个输入时,我正在尝试使用表单的默认行为选择(或突出显示)文本.我必须在我的密码表单字段中添加.select()函数,以便在IE8中工作.用于取消选择文本的jquery .select()是否等效?
$("#MyTextBox").focus(function() {
$(this).select();
});
$("#MyTextBox").blur(function() {
// Deselect here
});
Run Code Online (Sandbox Code Playgroud) 如何使用css媒体查询定位Windows phone 7?
现在,我正在尝试这个没有运气.
@media only screen and (max-width: 480px) and (min-width: 5px) { // css here }
Run Code Online (Sandbox Code Playgroud)
提前致谢
考虑以下代码:
public static class PredefinedStrings
{
public const string Golf = "Golfing";
public const string Basketball = "Basketball";
public const string HoolaHoops = "Hulahoops";
}
public class Sports
{
public string Name { get; set; }
}
如何强制Sports类的Name属性仅使用PredifinedStrings中的一个?
编辑: 我想避免使用枚举,因为值总是代表一个字符串.