本文整理汇总了C#中Validator.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Validator.ToString方法的具体用法?C# Validator.ToString怎么用?C# Validator.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validator
的用法示例。
在下文中一共展示了Validator.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateForm
/// <summary>
/// Performs custom validation and displays error in top of the page.
/// </summary>
/// <returns>Returns true if validation is successful.</returns>
protected bool ValidateForm()
{
// Validate name
string errorMessage = new Validator().NotEmpty(txtLastName.Text.Trim(), GetString("om.contact.enterlastname")).Result;
if (!String.IsNullOrEmpty(errorMessage.ToString()))
{
DisplayError(errorMessage);
return false;
}
// Validates birthday
if (!calBirthday.IsValid())
{
DisplayError(calBirthday.ValidationError);
return false;
}
// Validates email
if (!emailInput.IsValid())
{
DisplayError(emailInput.ValidationError);
return false;
}
return true;
}
示例2: ValidateForm
/// <summary>
/// Performs custom validation and displays error in top of the page.
/// </summary>
/// <returns>Returns true if validation is successful.</returns>
private bool ValidateForm()
{
// Validate name
string errorMessage = new Validator().NotEmpty(cmbContactLastName.Text.Trim(), GetString("om.contact.enterlastname")).Result;
if (!String.IsNullOrEmpty(errorMessage.ToString()))
{
lblError.Text = errorMessage;
lblError.Visible = true;
return false;
}
// Validates birthday
if (!calendarControl.IsValid())
{
lblError.Text = GetString("om.contact.enterbirthday");
lblError.Visible = true;
return false;
}
// Validates email
if (!String.IsNullOrEmpty(cmbContactEmail.Text) && !ValidationHelper.IsEmail(cmbContactEmail.Text))
{
lblError.Text = GetString("om.contact.enteremail");
lblError.Visible = true; return false;
}
return true;
}
示例3: IsValid
/// <summary>
/// Validates fields.
/// </summary>
private bool IsValid()
{
// Validates account name
string errorMessage = new Validator().NotEmpty(txtName.Text.Trim(), GetString("om.account.entername")).Result;
if (!String.IsNullOrEmpty(errorMessage.ToString()))
{
DisplayError(errorMessage);
return false;
}
// Validates email
if (!emailInput.IsValid())
{
DisplayError(emailInput.ValidationError);
return false;
}
return true;
}
示例4: ValidateForm
/// <summary>
/// Performs custom validation and displays error in top of the page.
/// </summary>
/// <returns>Returns true if validation is successful.</returns>
private bool ValidateForm()
{
// Validate name
string errorMessage = new Validator().NotEmpty(cmbAccountName.Text.Trim(), GetString("om.account.entername")).Result;
if (!String.IsNullOrEmpty(errorMessage.ToString()))
{
lblError.Text = errorMessage;
lblError.Visible = true;
return false;
}
// Validates email
if (!String.IsNullOrEmpty(cmbAccountEmail.Text) && !ValidationHelper.IsEmail(cmbAccountEmail.Text))
{
lblError.Text = GetString("om.contact.enteremail");
lblError.Visible = true; return false;
}
return true;
}