Validator and custom control question

H

Henk

Hello,

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?

thnx
Henk


private void RenderTextbox( HtmlTextWriter output, TextBox textbox )

{

RenderTRTD(output);

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 );

}

RenderTRTDEnd(output);

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top