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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:28:32+00:00 2026-05-17T17:28:32+00:00

I have a .aspx file and would like to add some HTML to it.

  • 0

I have a .aspx file and would like to add some HTML to it. The problem is that it can’t be modified. If I upgrade the product, this .aspx file will be overwritten and my modifications would have to be done again.

This is an open source product, so I can have a look at the codebehind. Again, I cannot modify it because that would break my upgrade path. Also, I need to add functionality that would never be included in the product, so sending in a patch is useless.

The class that’s referred to is a partial class, so I tried implementing an extra Page_PreRender by creating another partial class of the same name in the same namespace. However, since this is in another assembly, .net says it doesn’t know which is the correct class.

Is there any way I can do this?

  • 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-17T17:28:33+00:00Added an answer on May 17, 2026 at 5:28 pm

    So you can neither touch the .aspx of this page, nor the assembly containing its code behind? Sounds like you need to create a PageAdapter.

    Say you’re given this page…

    <%@ Page AutoEventWireup="true" ContentType="text/plain" Inherits="WebForm1" %>
    
    SomeControl: <asp:Literal runat="server" ID="SomeControl" />
    

    …with this code behind (in an assembly that you can only reference, not modify).

    public class WebForm1 : Page {
        protected void Page_Load(object sender, EventArgs e) {
            var SomeControl = (Literal) FindControl("SomeControl");
            SomeControl.Text = "Value set from code-behind.";
        }
    }
    

    What you can do is create a PageAdapter like so (in your own assembly):

    public class WebForm1Adapter : PageAdapter {
        protected override void OnLoad(EventArgs e) {
            base.OnLoad(e);
            var SomeControl = (Literal) Page.FindControl("SomeControl");
            SomeControl.Text = "Value set from control adapter.";
        }
    }
    

    Then finally, you need to register your override by creating a browser definition file:

    <browsers>
      <browser refID="Default">
        <controlAdapters>
          <adapter controlType="WebForm1" adapterType="WebForm1Adapter" />
        </controlAdapters>
      </browser>
    </browsers>
    

    Check the PageAdapter and ControlAdapter documentation to find out all the ways you can override the normal page behavior.

    This should make updating the third party page much less painful. No matter what you do though, merging updates will be inherently brittle. That is, unless the author of the third party page is consciously presenting some form of a stable API.

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

Sidebar

Related Questions

In the filesystem I have /file.aspx /directory/default.aspx I want to configure IIS so that
I have a page base class that has no .aspx file and so I
I have an ASPX page and on this page I have a control that
Inside my aspx file, I have the following html code inside an repeater: <div
I would like to have both these views: ~/Views/Customer/Index. aspx ~/Views/Customer/Index. ascx I would
I would like to make some changes to my EF4 edmx file without modifying
(Warning - asp newbie) I have an aspx file with the tag <%@ Page
For example, if I have a page located in Views/Home/Index.aspx and a JavaScript file
I have one aspx page with some controls. Also i have one DIV which
Let's say I have some Classic ASP pages that produce all output via Response.Write.

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.