locked
Creating server controls on the fly RRS feed

  • Question

  • User-1853937626 posted

    Is it possible to create custom server controls on the fly?

    I need a way to programatically output a control before the request handler finishes executing.

    Preferably in a HttpModule or HttpHandler as I don't have direct access to any Pages.

    Any ideas/help greatly appreciated.

    Monday, August 27, 2007 7:52 PM

Answers

  • User1622957740 posted

    Not really. You need to be within the context of a Page in order to add anything to it. Which means you have to use a handler subclassed from Page.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 28, 2007 4:18 AM
  • User-1853937626 posted

    Scott Guthrie wrote about a method to programmatically inject the output of user controls outside of a Page.

    Not a server control, but just about if not more useful.

    Here's the link:

    http://weblogs.asp.net/scottgu/archive/2006/10/22/Tip_2F00_Trick_3A00_-Cool-UI-Templating-Technique-to-use-with-ASP.NET-AJAX-for-non_2D00_UpdatePanel-scenarios.aspx 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 5, 2007 7:42 PM

All replies

  • User1622957740 posted

    Not really. You need to be within the context of a Page in order to add anything to it. Which means you have to use a handler subclassed from Page.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 28, 2007 4:18 AM
  • User-1853937626 posted

    Scott Guthrie wrote about a method to programmatically inject the output of user controls outside of a Page.

    Not a server control, but just about if not more useful.

    Here's the link:

    http://weblogs.asp.net/scottgu/archive/2006/10/22/Tip_2F00_Trick_3A00_-Cool-UI-Templating-Technique-to-use-with-ASP.NET-AJAX-for-non_2D00_UpdatePanel-scenarios.aspx 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 5, 2007 7:42 PM
  • User807886609 posted

    I'm reading the other responses to your post and it becomes clear that you need to provide more specific context about exactly what you need to do . This could be done with "pseudocode" just to show the flow of what you expect to be able to do.

     

    Wednesday, September 5, 2007 7:46 PM
  • User-1853937626 posted

    Yeah my bad. The original need was to be able to use embedded resources inside a IHttpModule or IHttpHandler.

    I wasn't aware that you could just instantiate Pages and access the ScriptManager.

    Didn't mean to be unclear.

    Wednesday, September 5, 2007 8:32 PM