我在MVC4中使用数据注释进行模型验证,并且我当前正在使用StringLengthAttribute但是我不想指定最大值(当前设置为50),但是DO想要指定最小字符串长度值.
有没有办法只指定最小长度?也许我可以使用另一个属性?
我目前的代码是:
[Required]
[DataType(DataType.Password)]
[Display(Name = "Confirm New Password")]
[StringLength(50, MinimumLength = 7)]
[CompareAttribute("NewPassword", ErrorMessage = "The New Password and Confirm New Password fields did not match.")]
public string ConfirmNewPassword { get; set; }
Run Code Online (Sandbox Code Playgroud)
任何帮助深表感谢.
asp.net-mvc minimum string-length data-annotations asp.net-mvc-4
我有这个屏幕,用户可以更改高度,基于此,我希望ScrollViewer在需要时显示滚动条,但它的大小始终相同。
请注意,只有父网格的第二行会更改大小(*),并且基于该大小我想要我的大小,并且基于滚动条应显示ScrollViewer的内部网格内容(通过代码动态添加)。ScrollViewer
<Grid Style="{StaticResource PopupBody}">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<!-- Header Panel -->
<StackPanel x:Name="PopupHeader"
Grid.Row="0">
<Label x:Name="PopupTitle"
Style="{StaticResource PopupTitle}"
Content="Column Updatable Detail"/>
</StackPanel>
<!-- Body Panel -->
<DockPanel x:Name="PopupBody"
Grid.Row="1"
Margin="10,10,10,0" Height="350" VerticalAlignment="Top">
<StackPanel DockPanel.Dock="Top" Margin="{StaticResource MarginSmallHorizontal}">
<Grid Margin="{StaticResource MarginSmallVertical}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="250" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
(... Hidden to be more readable ... ) …Run Code Online (Sandbox Code Playgroud) 我正在使用selectize.js这样的东西:
$( 'select' ).selectize( {
onChange: function( value ) {
// how to get original element here?
}
} );
Run Code Online (Sandbox Code Playgroud)
select页面上有几个元素.
我想知道select事件发生在哪里onChange.
我该怎么做?
asp.net-mvc ×1
grid ×1
javascript ×1
jquery ×1
minimum ×1
scrollviewer ×1
selectize.js ×1
wpf ×1