Dynamically adding controls to page SOURCE file

Discussion in 'ASP .Net' started by John Wallace, Aug 6, 2003.

  1. John Wallace

    John Wallace Guest

    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
    John Wallace, Aug 6, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greg
    Replies:
    1
    Views:
    337
  2. Bas Groeneveld

    Dynamically adding web controls to a page

    Bas Groeneveld, Jul 19, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    507
    Bas Groeneveld
    Jul 20, 2004
  3. Jason
    Replies:
    7
    Views:
    1,190
    Rajesh CKR
    May 4, 2006
  4. sonic
    Replies:
    0
    Views:
    403
    sonic
    Sep 21, 2006
  5. John Wallace

    Dynamically adding custom controls to page source file

    John Wallace, Aug 5, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    113
    John Wallace
    Aug 5, 2003
Loading...

Share This Page