Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Validator and custom control question

Thread Tools

Validator and custom control question

Posts: n/a

I have a custom control that overrides the base class render method. From
the Render method I got a call to the follwing method in the code snippet
below, problem is that the textbox gets rendered, but not the validator,
it's simply only leaving a span in the html page which prints the
erromessage, but no validation code, or even the ControlToValidate etc
params. Anyone having a clue what I am missing here?


private void RenderTextbox( HtmlTextWriter output, TextBox textbox )



output.Write ( "     " );

textbox.RenderControl( output );

// validator toevoegen

if ( this.Required )


m_oRFValidator = new RequiredFieldValidator();

m_oRFValidator.ErrorMessage = RFUtil.GetText( "RFV_ERRORMESSAGE" );

m_oRFValidator.ForeColor = System.Drawing.Color.Red;

m_oRFValidator.Display = ValidatorDisplay.Dynamic;

m_oRFValidator.EnableClientScript = true;

m_oRFValidator.ControlToValidate = textbox.ID;//.Replace( ":", "_");

m_oRFValidator.ID = "rfv" + textbox.ID;

m_oRFValidator.RenderControl( output );




Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Adding Validator Control at runtime in a Custom Control ASP .Net 1 12-17-2004 09:14 PM
Possible to create a composite control that has a child control that is a validator that validates the composite control itself? Jonathan Eric Miller ASP .Net Building Controls 2 07-22-2004 10:58 PM
How to get custom control to work with custom validator Scott Yenor ASP .Net Web Controls 0 01-27-2004 12:37 AM
Custom Textbox and Validator Control Pham Nguyen ASP .Net 2 01-11-2004 07:30 AM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM