User control to wrap existing code - how to do it?
Posted on 2009-06-29
We have an AJAX enabled .NET web site throughout which we use a customised GridView control. This is a class which is inherited from the standard GridView (System.Web.UI.WebControls.GridView). We would now like to wrap an AJAX Update Panel around each use of this custom GridView.
We could go through each page and insert the appropriate markup for the Update Panel whereever we use our custom web control, but I would like a more elegant (and less time consuming) solution.
I can't just change the existing custom web control, because it isn't an ascx and therefore it has no markup of its own. Similarly, I can't render an AJAX update panel whenever the custom gridview is rendered without doing all the essential AJAX plumbing that goes with it
I thought about a new ascx user control, but I can't find a way to wrap this around existing markup. Am I missing something horribly obvious here?
Any help greatly appreciated.