本文整理汇总了C#中System.Web.UI.WebControls.ServerValidateEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ServerValidateEventArgs类的具体用法?C# ServerValidateEventArgs怎么用?C# ServerValidateEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerValidateEventArgs类属于System.Web.UI.WebControls命名空间,在下文中一共展示了ServerValidateEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsAvailablePass
protected void IsAvailablePass(object source, ServerValidateEventArgs args)
{
var hashre = new PasswordHasher();
args.IsValid = (hashre.VerifyHashedPassword(Context.User.Identity.GetUserInfo().PasswordHash, args.Value)) ==
PasswordVerificationResult.Success;
}
示例2: CustomValidator1_ServerValidate
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
if (CheckBoxRegulamin.Checked)
args.IsValid = true;
else
args.IsValid = false;
}
示例3: CustomValidator4_ServerValidate
protected void CustomValidator4_ServerValidate(object source, ServerValidateEventArgs args)
{
if (CheckBox1.Checked && TextBox1.Text == "")
{
args.IsValid = false;
}
}
示例4: val_email
public void val_email(object source, ServerValidateEventArgs args)
{
Regex rgxEmail = new Regex(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
@"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
@".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
args.IsValid = rgxEmail.IsMatch(args.Value);
}
示例5: ValidateImage
private void ValidateImage(object source, ServerValidateEventArgs args)
{
if (FileUploadEdit.HasFile)
{
var bytes = FileUploadEdit.FileBytes;
try
{
var image = System.Drawing.Image.FromStream(new MemoryStream(bytes));
}
catch
{
// catch any error when user tries to load a file that
// is not an image recognised by System.Drawing
args.IsValid = false;
CustomValidator1.ErrorMessage = "Not an Image";
}
}
else
{
return;
// no file to download you decide wether this is a valid error
// to throw comment out
if (!FileUploadEdit.HasFile && String.IsNullOrEmpty(ImageEdit.ImageUrl))
{
args.IsValid = false;
CustomValidator1.ErrorMessage = "No file to download";
}
}
}
示例6: CvUserName_ServerValidate
protected void CvUserName_ServerValidate(object source, ServerValidateEventArgs args)
{
if (args.Value.Length >= 6)
args.IsValid = true;
else
args.IsValid = false;
}
示例7: cvProcName_ServerValidate
protected void cvProcName_ServerValidate(object source, ServerValidateEventArgs args)
{
//默认不存在该部门
args.IsValid = false;
//检测是否存在部门
args.IsValid = ydPublicMethod.IsExistProc(args.Value);
}
示例8: CheckDate
protected void CheckDate(object sender, ServerValidateEventArgs e)
{
DateTime date;
bool IsDate = DateTime.TryParse(e.Value, out date);
if (IsDate) e.IsValid = true;
else e.IsValid = false;
}
示例9: CheckPassword
protected void CheckPassword(object source, ServerValidateEventArgs args)
{
if (WebClient.RevalidatePassword(PasswordField.Text))
args.IsValid = true;
else
args.IsValid = false;
}
示例10: cvTitle_ServerValidate
protected void cvTitle_ServerValidate(object source, ServerValidateEventArgs args)
{
SqlDataAdapter da = new SqlDataAdapter("", connection);
DataTable dt = new DataTable();
DataTable dl = new DataTable();
da.SelectCommand.CommandText = "SELECT * FROM Skills WHERE ID = @sxid";
da.SelectCommand.Parameters.AddWithValue("@sxid", Request.QueryString["Sid"]);
da.Fill(dl);
//Consept : Check if TextBox' value has changed or not
//If This part doesn't Exist -> the page won't be valid Because of the next part of Validation. WHY? ...
//if the title isn't changed the next part cause invalidation beacuse the Title has already Exist
if (dl.Rows[0]["Title"].ToString() != txtTitle.Text)
{
da.SelectCommand.CommandText = "SELECT * FROM Skills WHERE [email protected] AND [email protected]";
da.SelectCommand.Parameters.AddWithValue("@t", txtTitle.Text);
da.SelectCommand.Parameters.AddWithValue("@scid", ddlSkillCat.SelectedValue);
da.Fill(dt);
//If the TextBox' Value has changed ...
//So , Now Check if The New Value has already Exist in Table or not
if (dt.Rows.Count == 0)
{
args.IsValid = true;
}
else
args.IsValid = false;
}
}
示例11: cvCaptcha_ServerValidate
protected void cvCaptcha_ServerValidate(object source, ServerValidateEventArgs args)
{
bool isValid = false;
if (ViewState["captchaToken"] != null)
{
Guid captchaToken = (Guid)ViewState["captchaToken"];
using (CSSDataContext db = new CSSDataContext())
{
var captcha = db.Captchas.FirstOrDefault(p => p.Id == captchaToken);
//args.Value
//CustomValidator cvCaptcha = (CustomValidator)source;
//TextBox txtValidationCode = (TextBox) cvCaptcha.ControlToValidate;
if (captcha != null && args.Value.Equals(captcha.Answer, StringComparison.InvariantCultureIgnoreCase) == true)
{
isValid = true;
}
}
}
if (isValid == false)
ViewState["captchaToken"] = null;
args.IsValid = isValid;
}
示例12: IsAvailableEmail
protected void IsAvailableEmail(object source, ServerValidateEventArgs args)
{
using (_repository)
{
args.IsValid = !_repository.Users.Select(s => s.Email).Contains(this.EmailTexbox.Text);
}
}
示例13: LogoValidator_ServerValidate
protected void LogoValidator_ServerValidate(object sender, ServerValidateEventArgs e)
{
if (e.Value.Length > 0)
{
e.IsValid = FileType.IsImageFile(e.Value);
}
}
示例14: CustomValidator_ServerValidate
protected void CustomValidator_ServerValidate(object source, ServerValidateEventArgs args)
{
//string imageName = Guid.NewGuid().ToString().Substring(0, 8);
//string geocacheImageTemp = imageName + ".bmp";
//System.Drawing.Bitmap bmpPostedImage = new System.Drawing.Bitmap(imageFileUpload.PostedFile.InputStream);
//bmpPostedImage.Save(Server.MapPath(@"temp\") + imageName + ".bmp");
////bmpPostedImage.Save("C:\\Users\\Juliana\\Documents\\GitHub\\ASECPJ\\ASECPJ\\geocache\\temp\\" + imageName + ".bmp");
//Stegano decryptStegano = new Stegano();
//string message = decryptStegano.RetrieveMessage(Server.MapPath(@"temp\") + imageName + ".bmp");
////string message = decryptStegano.RetrieveMessage("C:\\Users\\Juliana\\Documents\\GitHub\\ASECPJ\\ASECPJ\\geocache\\temp\\3a902149.bmp");
//if (message.Equals(""))
//{
// Response.Redirect("true");
// args.IsValid = true;
//}
//else
//{
// Response.Redirect("false");
// args.IsValid = false;
//}
args.IsValid = true;
}
示例15: CustomValidator1_ServerValidate
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
if (Image1.ImageUrl == "Images/icon_visa.png")
{
if ((txtCard.Text).Count() == 16 || (txtCard.Text).Count() == 13)
args.IsValid = true;
else
args.IsValid = false;
}
else
if (Image1.ImageUrl =="Images/apps_mastercard.png")
{
if ((txtCard.Text).Count() == 16)
args.IsValid = true;
else
args.IsValid = false;
}
else
if (Image1.ImageUrl =="Images/download.jpg")
{
if ((txtCard.Text).Count() == 15)
args.IsValid = true;
else
args.IsValid = false;
}
else args.IsValid = false;
}