So this just gets better - if you are a VFP WWC programmer, you'll love the C# WWC Tools if you are not using them already...
Every now and then I stumble onto a West Wind Utility that I don't know how I worked without.
RenderUserControl() is one.
If you're dynamically generating pages and doing stuff like this just to get a text box (which I still do in some cases)
TextBox = new Westwind.WebConnection.WebControls.wwWebTextBox(); TextBox.TextMode = Westwind.WebConnection.WebControls.TextBoxModes.SingleLine; TextBox.ID = "txtQty"; TextBox.UserFieldName = TextBox.ID; TextBox.Text = "1"; TextBox.Width = 100;
With RenderUserControl(), all you have to do is build an ascx user control (page and code behind) and dynamically add the whole generated page into your dynamic page code behind with one line of code. It's a lot like VFP WWC ExpandTemplate().
divUpsellItems.InnerHtml = Westwind.Utilities.WebUtils.RenderUserControl("~/UserControls/UpsellItemsCart.ascx", true, null);
Rick has written a whole article on RenderUserControl here.
http://www.west-wind.com/weblog/posts/2008/Apr/01/Rendering-individual-controls-for-AJAX-Callbacks
The West Wind Web & Ajax Toolkit for ASP.NET and Web Store are loaded with incredible tools like this one.