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 4019932
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:09:57+00:00 2026-05-20T10:09:57+00:00

Some ASP.NET controls only permit items of certain types, for example: <uc:MyControl runat=server….> <MyTableTemplate>

  • 0

Some ASP.NET controls only permit items of certain types, for example:

<uc:MyControl runat="server"....>

<MyTableTemplate>
  <MyTableRow .... />
  <MyTableRow .... />
  <MyTableRow .... />
</MyTableTemplate>

</uc:MyControl>

I’m trying to recreate this in my own custom control, such that you can only put MyTableRow objects into the template and Visual Studio will prevent the designer putting anything else in.

I’ve been looking at the ControlBuilder class but I am not fully certain it does what I want. In addition the examples do not mention the nesting I have above where the array of MyTableRow is within another template field.

Does anyone know how to achieve this?

Edit: The UpdatePanel seems to work this way: If you declare an UpdatePanel like this:

<asp:UpdatePanel>
<Triggers>

</Triggers>
</asp:UpdatePanel>

You cannot put anything in the Triggers section other than the two specific controls listed in intellisense, and you get a design-time error if you try. This is the exact behaviour I wish to mimic.

====

I tried to implement Alex’s suggestion, here is my code:

public partial class MyControl : System.Web.UI.UserControl
{
    [PersistenceMode(PersistenceMode.InnerProperty)]
    public ActionButtonCollection ActionButtons
    {
        get;
        set;
    }
}


public class ActionButtonCollection : Collection<ActionButton>
{

}

public abstract class ActionButtonBase
{
    public string Test { get; set; }
}

public class ActionButton : ActionButtonBase
{

}

However with this code there is no intellisense inside

<uc:MyCustomControl runat="server">
<ActionButtons>

</ActionButtons>
</uc:MyCustomControl >
  • 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-05-20T10:09:58+00:00Added an answer on May 20, 2026 at 10:09 am

    EDIT: added a link to the example of doing this to google docs.

    Firstly, build the website and then you’ll be able use this control with IntelliSense.

    Actually, <Triggers> property of UpdatePanel is not a template. It is just a collection of objects. You could achieve this by declaring you own class and a class which inherit Collection<YourClass>; then just add the public property of Collection<YourClass> type to your control and you will be able to archive the “update panel triggers” behaviour.

    Here is an example:

    public abstract class UpdatePanelTrigger
    {
        public string ControlId { get; set; }
    }
    
    public class UpdatePanelTrigger1 : UpdatePanelTrigger
    {
    
    }
    
    public class UpdatePanelTrigger2 : UpdatePanelTrigger
    {
    
    }
    
    public class UpdatePanelTriggerCollection : Collection<UpdatePanelTrigger>
    {
    
    }
    

    and finally, your control:

    public class MyControl : WebControl
    {
        [PersistenceMode(PersistenceMode.InnerProperty)]
        public UpdatePanelTriggerCollection Triggers { get; set; }
    }
    

    then you could use it on your page:

    <my:MyControl runat="Server">
        <Triggers>
            <my:UpdatePanelTrigger1 ControlId="ctrl1" />
            <my:UpdatePanelTrigger2 ControlId="ctrl2" />
        </Triggers>
    </my:MyControl>
    

    BTW, you cannot put anything to the Triggers section other than types which inherit from the UpdatePanelTrigger class.

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

Sidebar

Related Questions

Does the ASP.NET ClientServerManager provide some method or property to return the name of
I'm serving up a page using ASP.Net. I have Add/Edit/Delete functionality of controls I've
What are your techniques to using mobile with asp.net, I know how to detect
I am trying to set some client-side properties on a set of controls in
I am working on an ASP.net Forms Application that keeps track of information about
I need to estimate (and probably build later on) complex filter in ASP.NET WebForms
I have an ASP.NET WebForms page with forms authentication. When users create a login,
I have an ASP.NET DropDownList control that renders into a dropdown list (select HTML
Background I'm working on building an ASP.Net MVC 3 application that utilizes: JQueryUI for
I'm a bit new to ASP.NET. Actually, I'm a marginalized VB/SQL programmer who is

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.