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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:23:48+00:00 2026-05-27T20:23:48+00:00

Scenario : Default.aspx is as below. <%@ Page MasterPageFile=~/StandardLayout.master Language=C# CodeFile=Default.aspx.cs Inherits=_Default %> <%@

  • 0

Scenario :
Default.aspx is as below.

<%@ Page MasterPageFile="~/StandardLayout.master" Language="C#" CodeFile="Default.aspx.cs"     Inherits="_Default" %>
<%@ Register src=  "~/Controls/Us.ascx" tagname="AboutUs" tagprefix="site" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
    <div id="large">
       <site:AboutUs  ID="AboutUsControl" runat="server" />
    </div>
   <div id="small">
      <site:AboutUs  ID="AboutUsControl" runat="server" />
    </div>
</asp:Content>

AboutUs.ascx.cs assigns some value to a label control. In the above scenario, I want to re-use AboutUs within “div id=small” as the logic is same but only value change.

My question is within AboutUs.ascx.cs, I need some way to find out if it belongs within “”, assign Label1 = “I am here”. Otherwise Label1 = “I am everywhere”

I am trying to pass parameters but do I need to anything in the code-behind in default.aspx.cs? or any other suggestions.

Please suggest.

  • 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-27T20:23:48+00:00Added an answer on May 27, 2026 at 8:23 pm

    Make sure both user controls have unique ID’s. I’ll use AboutUsControl1 and AboutUsControl2. Declare a name property for your user control:

    private string _doWhat;
        public string doWhat
        {
            get { return _doWhat; }
            set { _doWhat = value; }
        }
    
        //Execute the check somewhere in your code to set the text you want.    
        private void Do_Something()
        {
            if (_doWhat == "Large")
            {
                //display "I am here"
            }
            else
            {
                //display "I am everywhere"
            }
        }
    

    And in the code behind on the page using the user controls, just pass the value by calling the public variable:

    AboutUsControl1.doWhat = "Large";
            AboutUsControl2.doWhat = "Small";
    

    or just set doWhat in the control itself:

    <site:AboutUs ID="AboutUsControl1" runat="server" doWhat="Large" />
    <site:AboutUs ID="AboutUsControl2" runat="server" doWhat="Small" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following scenario: http://www.yourdomain.com/Default.aspx?p=2 Now we ofcourse want to check if the querystring
I am trying Master Detail scenario in ASP.NET MVC 3 (default view engine) .
In the default TFS setup there are three work item types: scenario, task and
Scenario: foo.war file contains a default value of init parameter fooParam=1. This is defined
Hi there is a problem in my login page. The scenario is, For example
Hi I have a scenario where I need to convert the default Charset should
The default model binder does not seem to bind data in this scenario. Any
Here's the scenario: I have used default SqlMembershipProvider to implement membershp on a website.
Scenario: class BaseClass(models.Model): base_field = models.CharField(max_length=15, default=None) class SubClass(BaseClass): # TODO set default value
Is there a specific design pattern that describes the scenario where a non-abstract default

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.