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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:28:16+00:00 2026-05-26T10:28:16+00:00

Is it possible to reuse asp.net controls in multiple views within a MultiView? I

  • 0

Is it possible to reuse asp.net controls in multiple views within a MultiView? I would like to provide my customers the option to view and entry form as either a ASP.NET Wizard or as a Form depending on their preference. Most of my research has resulted in numerous hits for MVC, but I’m using WebForms and can’t find a definitive answer either way.

My theory is that this should be possible, but since the control is already defined elsewhere on the page, I ought to be able to simple tell it to re-display the same control at a different location.

For Example something like this perhaps:

<asp:MultiView ID="mv" runat="server" ActiveViewIndex="0">
    <asp:View ID="WizardView" runat="server">
        <asp:Wizard ID="wizzy" runat="server" ActiveStepIndex="0">
            <WizardSteps>
                <asp:WizardStep ID="WizardStep1" runat="server">
                    <!-- Wrapped in PlaceHolder goodness :P -->
                    <asp:PlaceHolder ID="wPH1" runat="server">
                        <asp:Label ID="MyLabel" runat="server" Text="Hello Stackies"></asp:Label>
                    </asp:PlaceHolder>
                </asp:WizardStep>
            </WizardSteps>
        </asp:Wizard>
    </asp:View>
    <asp:View ID="FormView" runat="server">
        <form action="#" method="post" id="wizzyform">
            <!-- I WANT TO REUSE THIS CONTROL HERE -->
            <asp:PlaceHolder ID="fPH1" runat="server"></asp:PlaceHolder>
        </form>
    </asp:View>
</asp:MultiView>

UPDATE WITH ANSWER!!

I simply added some PlaceHolders to my Markup and created a toggle button in my VB.NET Codebehind with the following.

Protected Sub ToggleView() Handles ViewToggleBtn.Click
    If RequestWizard_mv.ActiveViewIndex = 0 Then
        ViewToggleBtn.Text = "Toggle Wizard View"
        RequestWizard_mv.ActiveViewIndex = 1
        fPH1.Controls.Add(wPH1)
    ElseIf RequestWizard_mv.ActiveViewIndex = 1 Then
        ViewToggleBtn.Text = "Toggle Form View"
        RequestWizard_mv.ActiveViewIndex = 0
        wPH1.Controls.Add(fPH1)
    End If
End Sub

WOOT!! 😀 SO HAPPY!! You have no idea how much pain this saves me 😛

Note: I’ve noticed it doesn’t maintain state very well, but super easy fix compared to re-writing double the code >.<

  • 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-26T10:28:16+00:00Added an answer on May 26, 2026 at 10:28 am

    At least, you can have one instance of Label in your code-behind and add it programmatically to the desired place by condition using placeholders in both places.

    Also you can make a new user control, and place all the logic that covers your Label there. You will still have 2 instances of this control, but you will design your Label once.

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

Sidebar

Related Questions

I would like to reuse *.aspx files in multiple ASP.Net MVC projects. Is this
Is it possible to reuse a form in two different views in JSF? I
ASP.NET has the ability to detect potentially dangerous input from the client. I'd like
Is it possible to reuse classes like that in css: .aelement {display:block;....} .aelementhover {color:#fff;....}
In Python, how is it possible to reuse existing equal immutable objects (like is
Is it possible to re-use a client-template using asp.net ajax 4.0 client templates? I
I'm a LOB .NET applications developer that would like to do some www consumer
May be a dumb Question.But still, is it possible to reuse the views in
Possible Duplicate: C++ can I reuse fstream to open and write multiple files? why
The default scaffolded views generated by ASP.NET MVC 2 contain links such as: <%:

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.