Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. loading usercontrol templates dynamically from database

loading usercontrol templates dynamically from database

Scheduled Pinned Locked Moved ASP.NET
databasewpfcomhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    For_IT
    wrote on last edited by
    #1

    Hi all I have created usercontrol templates and stored the template code in database. The templates are for instance postcards, visiting cards etc.. I want to load these usercontrol templates dynamically to my web page. I referred to http://aspalliance.com site where the author has mentioned about use of usercontrol templates... I want to know how I can load the the usercontrol using the template code from database on the web page... please help me... thanks in advance...

    M M 2 Replies Last reply
    0
    • F For_IT

      Hi all I have created usercontrol templates and stored the template code in database. The templates are for instance postcards, visiting cards etc.. I want to load these usercontrol templates dynamically to my web page. I referred to http://aspalliance.com site where the author has mentioned about use of usercontrol templates... I want to know how I can load the the usercontrol using the template code from database on the web page... please help me... thanks in advance...

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi there. A UserControl, as a subclass of TemplateControl can use the LoadControl() method to load a usercontrol given a virtual file path. Unfortunately, there isn't an override that allows you to load a usercontrol given a string (which could be fed by your database source). However... in ASP.NET 2.0 we now have the VirtualPathProvider[^] class. It seems to me you may be able to build your own VirtualPathProvider to intercept requests for ".ascx" files and instead get that data from the database. That sounds like a pretty good concept for a CP article...

      1 Reply Last reply
      0
      • F For_IT

        Hi all I have created usercontrol templates and stored the template code in database. The templates are for instance postcards, visiting cards etc.. I want to load these usercontrol templates dynamically to my web page. I referred to http://aspalliance.com site where the author has mentioned about use of usercontrol templates... I want to know how I can load the the usercontrol using the template code from database on the web page... please help me... thanks in advance...

        M Offline
        M Offline
        minhpc_bk
        wrote on last edited by
        #3

        Just want to second Mike's suggestion with the VirtualPathProvider class. How to use virtual path providers to dynamically load and compile content from virtual paths in ASP.NET 2.0[^]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups