|
using System;
using System.Text;
using System.Web.UI;
using System.Globalization;
using System.IO;
namespace DeKale.WebControls
{
/// <summary>
/// A simple AnywherePlaceHolder. Works fine for controls that output static
/// html, contain no javascript functions, buttons and don't have to be referenced
/// from javascript code.
/// </summary>
public class SimpleAnywherePlaceHolder : BaseAnywherePlaceHolder
{
/// <summary>Overridden.</summary>
/// <param name="writer">The <see cref="System.Web.UI.HtmlTextWriter"/> object</param>
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
// Checks if Properties are set correctly.
this.PreRenderCheck();
// Render the control
base.Render(writer);
// Check if the RenderMethod is RenderNormal. If so, than we're done.
if (this.RenderMethod == AnywhereRenderMethodType.RenderNormal) return;
// Create a HtmlTextWriter to buffer the output
HtmlTextWriter buffer = new HtmlTextWriter(
new StringWriter(CultureInfo.InvariantCulture));
// get the output of the ChildControls in the buffer
base.RenderChildren(buffer);
// Put the buffered text into a string
string renderedChildren = buffer.InnerWriter.ToString();
// Write the call to the JavaScript function to the page.
this.Page.ClientScript.RegisterStartupScript(
this.GetType(),
this.DestinationControlId,
this.CreateScriptCall(renderedChildren),
true
);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.