在datagridview vb.net中验证电子邮件地址和号码 [英] Validation of email address and number in datagridview vb.net

查看:84
本文介绍了在datagridview vb.net中验证电子邮件地址和号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何验证vb.net中datagridview的电子邮件地址列和电话号码列

请帮忙.. !!!

提前致谢

how to validate the email address column and the telephone number column of a datagridview in vb.net

Please help..!!!

Thankss in advancee

推荐答案


protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

//Checking EditIndex should be same as current Row Index, then bind the validation controls in that particular row.

if (GridView1.EditIndex == e.Row.RowIndex)
{
RegularExpressionValidator regexpvalidator = new RegularExpressionValidator();
regexpvalidator.ID = "RegularExpressionValidator1";
regexpvalidator.ValidationExpression = "\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
regexpvalidator.ControlToValidate = "TextBox4";
regexpvalidator.ErrorMessage = "Invalid Email Id";
regexpvalidator.SetFocusOnError = true;
e.Row.Cells[3].Controls.Add(regexpvalidator);

}
}
}



从以下链接中获取最佳示例;
http://csharpdotnetfreak.blogspot.com/2011/12/createuserwizard-email-verification.html [^ ]



Get the best examples from following links;
http://www.asp.net/web-forms/tutorials/data-access/editing,-inserting,-and-deleting-data/adding-validation-controls-to-the-editing-and-inserting-interfaces-vb[^]
http://csharpdotnetfreak.blogspot.com/2011/12/createuserwizard-email-verification.html[^]


这篇关于在datagridview vb.net中验证电子邮件地址和号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆