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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:01:11+00:00 2026-05-11T18:01:11+00:00

Hope you’re having a good Friday and stuff… okay, so here’s my question: All

  • 0

Hope you’re having a good Friday and stuff… okay, so here’s my question:

All my ASPX pages inherit from a base class called BasePage. BasePage inherits from:

System.Web.UI.Page

Now, how do I access/set a control in my aspx page from my page base? I’ve tried this:

HyperLink hypMainMenu = (HyperLink)Page.FindControl("hypMainMenu");
hypMainMenu.NavigateUrl = AppConfiguration.AppSettings.Urls.MainMenu;

But hypMainMenu is always null – I can’t find the bastard. Any ideas? Or is this bad practice and someone can reccommend a better way to do this?

Thanks in advance!

  • 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-11T18:01:11+00:00Added an answer on May 11, 2026 at 6:01 pm

    Even though what is and is not good practice is very subjective, I must say that trying to access anything from a control from it’s base class is bad practice. A base class should only contain code that is relevant for all classes that will inherit it, and how do you know that every page you write in the future will have this control?

    A better way to solve your problem (which I assume to be having code for your main menu in only one place) would be to write a UserControl and which you include on every page. If you need to do something specific with that control, you can do it in the UC‘s CodeBehind.

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

Sidebar

Related Questions

Hope you all are fine and rocking your code editors. My question is how
Hope someone can help me here? Having an issue getting text that's located inside
Hope you all had a good weekend. We're just about to sign up to
hope all of you doing well. I have small question in C#.Net. actually i
hope you all had a happy new year. So, my question is, what's the
Hope you can help. In my ASP.net MVC3 app, all my controllers descend from
hope you're having a good day. Another socket issue, another day :) I finally
Hope this question is not stupid since I am an amateur web designer. I
hope someone can answer this. Here is some sample code. namespace std { #ifdef
hope all is swell! I was hoping I had cracked this problem but it

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.