使用dataInput:DescriptionViewer对输入的数据进行校验
2011-12-23 07:02
369 查看
使用此功能时,主要分为两步:
1、在数据校验字段中,添加用于界面显示的标识:
[Display(Name="登录名称", Description="输入登录名称")]
[Required(ErrorMessage="请输入登录名称")]
public string loginName{}
<TextBox Height="23" Name="textBox1" Text="{Binding pcode, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" Grid.Row="1" Grid.Column="1" />
<dataInput:DescriptionViewer Name="dvLoginName" Grid.Row="1" Grid.Column="2" Target="{Binding ElementName=user}" PropertyPath="pcode" />
//显示出错汇总
<dataInput:ValidationSummary Grid.Row="5" Grid.Column="1"/>
显示结果:
1、在数据校验字段中,添加用于界面显示的标识:
[Display(Name="登录名称", Description="输入登录名称")]
[Required(ErrorMessage="请输入登录名称")]
public string loginName{}
如果未添加此标识,显示时:loginName 为必需字段
2、设置显示的方式:<TextBox Height="23" Name="textBox1" Text="{Binding pcode, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" Grid.Row="1" Grid.Column="1" />
<dataInput:DescriptionViewer Name="dvLoginName" Grid.Row="1" Grid.Column="2" Target="{Binding ElementName=user}" PropertyPath="pcode" />
//显示出错汇总
<dataInput:ValidationSummary Grid.Row="5" Grid.Column="1"/>
显示结果:
相关文章推荐
- Flex 在TextInput里输入值,对datagrid进行数据筛选
- Android应用开发中如何使用RSA加密算法对数据进行校验
- JData 使用教程 对输入数据进行验证(服务端验证)
- 使用structs2进行ognl进行各种html元素输入数据
- 通过Ajax方式上传文件(input file),使用FormData进行Ajax请求
- 【Asp.Net从零开始】:使用LinqToData与QueryExtender对数据进行筛选性输出
- 【java IO】使用Java输入输出流 读取txt文件内数据,进行拼接后写入到另一个文件中
- Java中使用RSA对请求和接收数据进行签名校验
- 使用Simulation Data Inspector(信号查看器)进行信号数据调试
- 使用hibernate进行数据校验那些事
- 使用jsp来实现对表单对象当中的数据进行校验
- Android应用开发中如何使用RSA加密算法对数据进行校验
- struts2使用validate方法来实现对表单输入数据的校验操作
- jquery 数据校验,input只能输入浮点数
- ABAP WB01 BDC ”No batch input data for screen & &“ ”没有屏幕 & & 的批输入数据“
- ofbiz 使用迷你语言对请求数据进行校验
- 使用annotation在.NET MVC的Model进行数据校验
- input输入时使用正则表达式全角半角进行限制
- input只能输入数字,对数字进行判断,且修复IE下无法使用光标,无法中间输入的问题
- kettle中Get Data from XML , Jason Input , 文本文件输入 使用示例