更新时间:2023-12-03 18:38:04
***的方法是使用Javascript或ASP在UI中进行所有这些验证。净验证控件,如必需表达式验证控件。
检查以下链接 -
ASP.NET - 验证器 [ ^ ]
使用客户端验证JavaScript [ ^ ]
您可以在属性层中仔细检查这些,如下所示 -
The best way is to do all these validation in the UI using Javascript or ASP.Net validation controls like Required Expression Validation control.
Check following links-
ASP.NET - Validators[^]
Client Side Validation using JavaScript[^]
You can double check these in the Property layer too like following -
string courseNum;
public string CourseNum
{
get { return courseNum; }
set {
if(value==null) throw new ArgumentException("Course Num can't be null.");
courseNum = value;
}
}
希望有所帮助:)
Hope it helps :)