|
using System;
using System.Reflection;
using HtmlUI = System.Web.UI.HtmlControls;
using WebCtlUI = System.Web.UI.WebControls;
using WebUI = System.Web.UI;
namespace BasePageFramework
{
/// <summary>
/// Summary description for MasterServerForm.
/// </summary>
public class BaseServerForm : HtmlUI.HtmlForm
{
private WebCtlUI.PlaceHolder _uiTemplatePlcHldr = new WebCtlUI.PlaceHolder();
internal BaseServerForm(HtmlUI.HtmlForm oldFrm,IBaseTemplate uiTemplate)
{
foreach(string key in oldFrm.Attributes.Keys)
this.Attributes.Add(key,oldFrm.Attributes[key]);
System.Type frmTp = oldFrm.GetType();
//move the controls first - so they are located in the main form before we
//rip apart the htmlform via reflection
while(oldFrm.Controls.Count > 0)
uiTemplate.ContentArea.Controls.Add((System.Web.UI.Control)oldFrm.Controls[0]);
//copy the old form's values into our new form...
foreach(FieldInfo fields in frmTp.GetFields(BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.Instance))
this.GetType().GetField(fields.Name,
BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.Instance).SetValue(this,fields.GetValue(oldFrm));
this._uiTemplatePlcHldr.Controls.Add((System.Web.UI.Control)uiTemplate);
this.Controls.Add((System.Web.UI.Control)this._uiTemplatePlcHldr);
}
public IBaseTemplate BaseTemplate
{
get
{
return (IBaseTemplate)_uiTemplatePlcHldr.Controls[0];
}
}
}
}
|
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.