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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:48:11+00:00 2026-06-01T00:48:11+00:00

my structure is like this: master page aspx(web form) ascx(user control) I have a

  • 0

my structure is like this:
master page
aspx(web form)
ascx(user control)

I have a master with a menu:

<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false"
                IncludeStyleBlock="false" Orientation="Horizontal">
<Items>
            <asp:MenuItem Text="Parameters" Value="Parameters">
                   <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Default" Value="def" />
    </asp:MenuItem>
</Items>
</asp:Menu>

Inside the MenuItem there’s got to be a link to these usercontrols that i want to load on my default.aspx

I have to diferent user controls:

user control 1:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucTest1.ascx.cs" Inherits="ucTest1" %>
<table>
<tr>
    <td>
        <asp:Label ID="Label1" runat="server" Text="TEST 1 ASCX"></asp:Label>
    </td>
</tr>
<tr>
    <td>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    </td>
</tr>
</table>

user control 2:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucTest2.ascx.cs" Inherits="ucTest2" %>
<table>
<tr>
    <td>
        <asp:Label ID="Label2" runat="server" Text="TEST 2 ASCX"></asp:Label>
    </td>
</tr>
<tr>
    <td>
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    </td>
</tr>
</table>

here is my Default.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/Master/Site.master" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="Default" %>
<%@ Register Src="~/ucTest1.ascx" TagName="ucTest1" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
    <uc1:ucTest1 ID="ucTest1" runat="server" />
</asp:Content>

it works good so far but i want to make those menuitems on my master page to switch between these two user controls in the same Default.aspx.
so when i click on test1-menuitem it brings me the ucTest1 into my default.aspx and when clicking the test2-menuitem brings me the uctest2 into my default.aspx too.

i dont know if this can be done. I’d really appreciate your help!

thanks!

  • 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-06-01T00:48:12+00:00Added an answer on June 1, 2026 at 12:48 am

    I would use the QueryString to determine which user control to display. For example:

    <asp:MenuItem NavigateUrl="~/default.aspx?uc=test" ...>
    

    Set the default visibility of the user controls to false, and on Page_Load use a little logic to determine which control should be visible:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            switch (UserControlType)
            {
                case "test":
                    ucTest1.Visible = true;
                ...
            }
        }
    }
    
    private string UserControlType
    {
        get { return Request.QueryString["uc"]; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

 my web site structure is like this :     1- master page with stylesheet and
I have a SVN structure like this: /Projects /Project1 /Project2 /someFolder /Project3 /Project4 I
Given a table structure like this: CREATE TABLE `user` ( `id` int(10) unsigned NOT
I have a structure like this: <ul> <li>text1</li> <li>text2</li> <li>text3</li> </ul> How do I
Currently I have a structure like this: A | +--B | +--C It's mapped
I have a structure like this.... UITableViewController -> UITableViewCell -> UIView I need the
I have a folder structure like this: /some_folder /tmp /tmp/foo /tmp/foo/fu * /tmp/bar /tmp/bar/bah
I have a folder structure like this: /articles .index.php .second.php .third.php .fourth.php If I'm
I have multiple projects with directory structure like this: /application/ /images/ /js/ /css/ /system/
This is the scenario: I have a Master Page, In the Master Page I

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.