Validator and custom control question

Discussion in 'ASP .Net Building Controls' started by Henk, Apr 13, 2004.

  1. Henk

    Henk Guest

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

    }
     
    Henk, Apr 13, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pham Nguyen

    Custom Textbox and Validator Control

    Pham Nguyen, Jan 10, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    10,719
    Pham Nguyen
    Jan 11, 2004
  2. Replies:
    1
    Views:
    623
    Elmer CarĂ­as
    Dec 17, 2004
  3. Matt Sokol
    Replies:
    2
    Views:
    426
    Theo Tillotson
    Aug 7, 2003
  4. Donal McWeeney

    custom validator and ControlToValidate in a composite control...

    Donal McWeeney, Sep 28, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    240
    Donal McWeeney
    Sep 29, 2004
  5. Scott Yenor

    How to get custom control to work with custom validator

    Scott Yenor, Jan 27, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    234
    Scott Yenor
    Jan 27, 2004
Loading...

Share This Page