471,599 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 software developers and data experts.

Custom Validator Problem

Hi group, i'm trying to add a customvalidator control to a custom web
control. The problem is i'm getting a "Unable to find control id..."
exception. Here is the code:

public class CuitTextBox : WebControl
{
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}

protected override void OnPreRender(EventArgs e)
{
Control numericTextBox =
Page.LoadControl("~/WebControls/NumericTextBox.ascx");

TextBox underliyingText =
numericTextBox.FindControl("txtTextBox") as TextBox;
CustomValidator validator = new CustomValidator();

validator.ControlToValidate = underliyingText.ClientID;
validator.ErrorMessage = "El CUIT ingresado es invalido";
validator.ClientValidationFunction = "ValidateCuit";
validator.Visible = true;
validator.Enabled = true;
validator.EnableClientScript = true;

Controls.Add(validator);
Controls.Add(numericTextBox);

PageUIHelper.RegisterJsUtilFile(Page);

base.OnPreRender(e);
}
}

Thanks in advance for any help

Dec 27 '06 #1
0 970

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Richard Payne | last post: by
5 posts views Thread by Mattyw | last post: by
9 posts views Thread by wardy1975 | last post: by
3 posts views Thread by Andy | last post: by
reply views Thread by tsw_mik | last post: by
3 posts views Thread by Rich Squid | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.