I'm making a website that requires ads being repeated down the length of a page with dynamic length. I want the ads to be displayed down the entire length of the page, but I won't know that length until after the data has been displayed. Is there built in functionality for this in .NET? If not, does anyone see any workarounds I could employ to do this for me?
Thanks!
I think you will best solve this problem by calling back to the server (via AJAX) to get the ads after the page has rendered on the end-user's browser.
You could do this via several technologies (AJAX.NET and UpdatePanels, plain-old-Javascript, or a JS framework like jQuery or MooTools along with a Web Service to serve up the ads), depending on your comfort.
With jQuery + ASHX option, you can do the following:
In the Javascript:
In the HTML:
MyHandler.ashx:
Obviously the most integrated with ASP.NET is the UpdatePanel option, though I would recommend that you move towards using a JS framework with .ASHX (custom handlers) or .ASMX (web services) on the server side. It is much more transparent and comprehensible, in terms of knowing "what is this code doing?". UpdatePanels can seem like black magic.