Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7758433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:21:32+00:00 2026-06-01T13:21:32+00:00

I have a RadEditor and I’m trying to add a CustomValidator to it, as

  • 0

I have a RadEditor and I’m trying to add a CustomValidator to it, as so:

protected override void OnInit(EventArgs e)
{
    var validator = new CustomValidator();
    validator.CssClass = "validator-error";
    validator.Display = ValidatorDisplay.Dynamic;
    validator.ControlToValidate = ".";
    validator.Text = "You've exceeded the maximum allowed length for this field";
    validator.ClientValidationFunction = "radEditorCheckLength";

    this.Controls.Add(validator);

    base.OnInit(e);
}

Which works fine, however when it renders, the validator is actually rendering inside the RadEditor. How do I make it appear before the RadEditor element?

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:21:33+00:00Added an answer on June 1, 2026 at 1:21 pm

    This is a total hack. Does it work?

    protected override void Render(HtmlTextWriter writer)
    {
        this.validator.RenderControl(writer);
        this.validator.Visible = false;
        base.Render(writer);
        this.validator.Visible = true;
    }
    

    You’ll need to store your CustomValidator in a field:

    private CustomValidator validator;
    
    protected override void OnInit(EventArgs e)
    {
        this.validator = new CustomValidator();
        // ...
    }
    

    (I disassembled RadEditor in Reflector, but I didn’t see an easy way to modify RenderChildren to skip rendering the validator.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following click event. protected void btnUpdate_Click(object sender, EventArgs e) { foreach
Have some code: using (var ctx = new testDataContext()) { var options = new
I have a custom server control which wraps a RadEditor (basically a textarea). I
Have a painfully simple blog Post creator, and I'm trying to check if the
I have a radEditor which consists of an IFrame that contains an editable 'content
I'm trying to create a datatable with the in cell editor. I have a
have been trying couple of hours now to make my iphone app universal. The
I have a RadEditor on a page, and it is breaking authentication on the
Currently I have to click the Spell check button on RadEditor's toolbar to see
I want to modify the custom validator below so it checks that the RadEditor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.