Dynamically adding controls to page SOURCE file

J

John Wallace

Hi,
I have a class, derived from "Control" which I can include on a page
using:

<tag:MyControl attr1=value></tag:MyControl>

My questions are:
1. What's the best way to programatically add this reference to pages
on the server - to the actual source file as opposed to generating it
upon page request?
2. What's the best way to parse source code like this and RETRIEVE all
such references, to interrogate the attributes?
3. Are there any classes that will let me build a well-formed
reference (like the one above) - as opposed to just concatenating the
string manually!

e.g. If the following aspx page is uploaded:
<%@ Page language="c#" Codebehind="NewPage.aspx.cs"
AutoEventWireup="false" Inherits="NS.NewPage" %>

<html><head></head>
<body>
Some Text
</body>
</html>

It should change to this:

<html><head></head>
<body>
<tag:MyControl attributes...></tag:MyControl>
Some Text
</body>
</html>

I have valid reasons for doing this! Obviously I can use string-based
methods to update the source but I'm sure there's a better way

Thanks.
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top