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

  • SEARCH
  • Home
  • 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 34237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:02:48+00:00 2026-05-10T14:02:48+00:00

I want to create a number of masked edit extenders from codebehind. Something like:

  • 0

I want to create a number of masked edit extenders from codebehind. Something like:

private MaskedEditExtender m_maskedEditExtender; protected override void OnLoad(EventArgs e) {     base.OnLoad(e);     m_maskedEditExtender = new MaskedEditExtender()     {         BehaviorID = 'clientName'     };     m_maskedEditExtender.Mask = '999999999';     this.Controls.Add(m_maskedEditExtender); } protected override void Render(HtmlTextWriter writer) {     m_maskedEditExtender.RenderControl(writer); } 

When I do this, I get a NullReferenceException on OnLoad of MaskedEditExtender. What is the correct way of doing that? Please note that putting the extender into a repeater-like control and using DataBind does not work for me.

Edit: I do not have an update panel. Turns out I also need to specify a target control on serverside.

  • 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. 2026-05-10T14:02:49+00:00Added an answer on May 10, 2026 at 2:02 pm

    See ASP.NET Page Life Cycle Overview if this is in a Page subclass. If you scroll down to the event list, that page advises you to use the PreInit event to create any dynamic controls. It’s necessary to do that early to ensure that ASP.NET cleanly loads ViewState at the right stage, among other things.

    If you are doing this in a web user control or custom control, though, override CreateChildControls and do this in there.

    Post a more complete code example if that doesn’t help.

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

Sidebar

Related Questions

I want to do something like this: Create a number of assemblies that implement
I want to create a number on the page that says something like 1,299,282
I want to create certain number of threads in my program where the number
I want to create dynamic number of thread which is depends on the database
I want to create a report which aggregates the number of activities per customer
I want to create a web page where a registered user picks a number
i want to create a NFC SmartPoster which dial a number with Action Record
I want to create a number of hidden objects via jQuery, that (once all
I want to create a random number function but I don't want to use
I want to create a class that could hold any of a number of

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.