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

The Archive Base Latest Questions

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

got an Default.aspx its Codebehind has a Method: public void DoSomething(){} The Default.aspx has

  • 0

got an Default.aspx

its Codebehind has a Method: public void DoSomething(){}

The Default.aspx has got a UserControl.ascx

In the Codebehind of my UserControl.ascx I would like to call my DoSomething() from Default.aspx, but this doesn’t works:

Default defaultPage = new Default();
defaultPage.DoSomething();

How can I achieve this?
(Default.aspx is also the StartupPage of the Masterpage)

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

    Default defaultPage = new Default(); would create a new instance of your page, which isn’t what you want.

    From your usercontrol, you could do something like this:

    ((Default)Page).DoSomething();
    

    Or to be safe and ensure that the Page is of type Default since a user control could exist on many different pages (which is why this may not be the best idea).

    Default p = Page as Default;
    if( p != null )
        p.DoSomething();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit : I've got an aspx file (default.aspx) that loads a flash file (index.swf),
I Build a module login using google account like http://noi.vn/Home/Default.aspx , I use OAuthBase.cs
I've got a textbox and a button on a form on default.aspx and in
So I got 2 .aspx files. One called login and one called default. The
Got a Site.Master (Masterpage) Got Default.aspx (Page) And in the Default.aspx , there is
Working on the Loginmechanism... But got problems.. I have a UserControl ( LoginUserControl.ascx )
I use the following directive in my aspx page: <%@ Page Language=C# AutoEventWireup=true CodeBehind=Default.aspx.cs
I've got webform routing setup on my asp.net webforms 3.5sp1 project. I would like
I've got a quick question about default values in PL/SQL functions in Oracle. Take
I've got a problem with the Silverlight default VS2008 project. Wnen I create a

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.