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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:13:44+00:00 2026-05-24T11:13:44+00:00

Enviroment: Asp.Net 3.5, VS 2008, Windows XP Hello, i have a user control (uc:StackUC)

  • 0

Enviroment: Asp.Net 3.5, VS 2008, Windows XP

Hello, i have a user control (uc:StackUC) such as:

<fieldset>
<legend>blablabla</legend>
<%-- other fields --%>
<asp:PlaceHolder ID="contentHolder" runat="server"></asp:PlaceHolder>
<asp:Button runat="server"/>
</fieldset>

My idea is to use on my pages, like this (due to lots of repetition):

...
<uc:StackUC>
<label>specific content</label>
<%-- blablabla --%>
</uc:StackUC>
...

I believe it has to do with templated user controls, however, all the examples i find have no pre-defined user controls, and are aimed at doing

<%#Container.Index %> (or any other property)

Which is not useful to me.

Thanks in advance.

References for templated user controls: http://leedale.wordpress.com/2007/08/11/creating-a-templated-user-control-with-aspnet-20/, http://msdn.microsoft.com/en-us/library/36574bf6(vs.71).aspx#Y456

  • 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-24T11:13:46+00:00Added an answer on May 24, 2026 at 11:13 am

    The following codes are simplified.

    The user-control ascx:

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="BaseFormControl.ascx.cs"
        Inherits="SOPR.CustomForms.BaseFormControl" %>
    <fieldset class="fset1">
    </fieldset>
    

    This is my user control code-behind:

    public partial class BaseFormControl : System.Web.UI.UserControl
        {
    
    
    
            [TemplateContainer(typeof(ContentContainer))]
            [PersistenceMode(PersistenceMode.InnerProperty)]
            [TemplateInstance(TemplateInstance.Single)] //IMPORTANT, makes controls visible in page code-behind
    
            public ITemplate Content { get; set; }
    
    
    
       void Page_Init()
            {
    
    
    
    
                if (Content != null)
                {
                    ContentContainer cc = new ContentContainer();
                    Content.InstantiateIn(cc);
                    contentHolder.Controls.Add(cc);
                }
            }
    

    My usage in the view:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddOperator.aspx.cs"
        Inherits="SOPR.Cadastro.AddOperator" MasterPageFile="~/MasterPage.Master" %>
    
    <asp:Content ContentPlaceHolderID="ContentPlaceHolder1" ID="maincont" runat="server"     EnableViewState="true">
        <uc:BaseFormControl ID="BaseFormControl1" runat="server">
            <Content>
          <asp:TextBox runat="server" CssClass="keytbcss" MaxLength="4" ID="keytb"
                    NewLine="false" />
            </Content>
        </uc:BaseFormControl>
    

    This is actually a copy of the results of my other question post.

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

Sidebar

Related Questions

On a Windows Server 2008/IIS 7.5 environment, when I browse to a ASP.NET web
My environment: Windows Server 2008, IIE 7.0, ASP.NET I developed a Silverlight client. This
I was wondering if developing ASP.NET applications on Windows Server 2008 was a good
My environment is ASP.Net + IIS 7.0 + Windows Server 2008 + .Net 3.5.
We have a new ASP.NET project on VS 2008 environment, and a new TFS
Environment: Windows 2003 Server (32 bit); IIS6, ASP.NET 2.0 (3.5); 4Gb Ram; 1 Worker
I'm trying to write a simple website (ASP.NET v4), which will call Windows Search,
I have a new WIndows Server 2008 R2 x64 DataCentre with Framework 3.5 SP1
I have an ASP.NET application that runs on our intranet. In production I can
Enviroment: asp.net framework 2.0 I'm having problems with the Delete method of and ObjectDataSource

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.