Thank You Very much for your Reply

Here is my code thats Works perfectly

 #region TextBox Email Validation
 public class EmailTextBox : System.Web.UI.WebControls.TextBox
 {
  private System.Web.UI.WebControls.RegularExpressionValidator reg;
  public string InvalidMessage;
  public string ClientScript="true";
  protected override void OnInit(EventArgs e)
  {
   reg = new System.Web.UI.WebControls.RegularExpressionValidator();
   reg.ControlToValidate = this.ID;
   reg.ErrorMessage = this.InvalidMessage;
   reg.EnableClientScript = (this.ClientScript.ToLower()!="false");
   reg.ValidationExpression = @"[^ ]...@[^ ]+\.[^ ]+";
   Controls.Add(reg);
  }
  protected override void Render(HtmlTextWriter w)
  {
   base.Render(w);
   reg.RenderControl(w);
  }
 }
 #endregion

Reply via email to