B
Benjamin Joldersma
Hello,
Last year my company migrated our old jscript asp application to jscript.net, and since then have been trying to as much new functionality in c# with web forms, http modules, and so forth. Unfortunately, since the bulk of our application still relies on a procedural response.write theme, a fair amount of our new work has been unable to take advantage of the real power of asp.net
In response to this, this week I wrote some simple support classes to allow for loading and rendering a user control within the current context of the Response.Write buffer. This works fine for controls that don't handle any events, but if I handle the control's Page_Load event, of course nothing happens. Now I understand that this is because I haven't added the control to the page's Controls collection, and if I do this, the event is executed, but unfortunately, shows up at the end, after all the legacy Response.Write code has run. Not having the advantage of a placeholder control makes things very difficult
I have a couple ideas about how I could get this to work: 1) search and replace all Response.Write functions with a function to create and add a Literal Control, thus the Page.Controls.Add call would insert the control into the current location in the logical HTML stream. 2) Insert my own custom placeholder tag and replace the tag with the properly rendered control with a HttpModule on the Application_EndRequest event
However, I don't really like either of these ideas very much - does anyone else have any suggestions? Being able to do this would be a huge win, as we could move to RAD techniques almost exclusively, and move on from and contain the old, spagetti-code mess
Thanks
Ben Joldersma
Sr. Software Developer
TheInsiders.com
Citadel Media, Inc.
Last year my company migrated our old jscript asp application to jscript.net, and since then have been trying to as much new functionality in c# with web forms, http modules, and so forth. Unfortunately, since the bulk of our application still relies on a procedural response.write theme, a fair amount of our new work has been unable to take advantage of the real power of asp.net
In response to this, this week I wrote some simple support classes to allow for loading and rendering a user control within the current context of the Response.Write buffer. This works fine for controls that don't handle any events, but if I handle the control's Page_Load event, of course nothing happens. Now I understand that this is because I haven't added the control to the page's Controls collection, and if I do this, the event is executed, but unfortunately, shows up at the end, after all the legacy Response.Write code has run. Not having the advantage of a placeholder control makes things very difficult
I have a couple ideas about how I could get this to work: 1) search and replace all Response.Write functions with a function to create and add a Literal Control, thus the Page.Controls.Add call would insert the control into the current location in the logical HTML stream. 2) Insert my own custom placeholder tag and replace the tag with the properly rendered control with a HttpModule on the Application_EndRequest event
However, I don't really like either of these ideas very much - does anyone else have any suggestions? Being able to do this would be a huge win, as we could move to RAD techniques almost exclusively, and move on from and contain the old, spagetti-code mess
Thanks
Ben Joldersma
Sr. Software Developer
TheInsiders.com
Citadel Media, Inc.