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

I'm using a bunch of different asp.net validation controls on a web form. Some
ASP.NET: Could anyone provide some C# paging codes in Repeater or ListView controls for
I'm writing an ASP.Net webform with some DropDownList controls on it. Then user changes
I have a form in my asp.net mvc(C#) application which handles some dynamic controls.
I was writing some ASP.NET control when I came to the scenario where I
Lets say you need to attach some JavaScript functionality to an ASP.NET User Control
I have some ASP.NET web services which all share a common helper class they
I have some ASP.NET Master Pages located in one assembly. I need to use
I have some ASP.NET page and webservice WebMethod() methods that I'd like to add
So the controller context depends on some asp.net internals. What are some ways to

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.