using CoolExt = Coolite.Ext.Web;
namespace Coolite.Ext.ux.Samples
{
public class CustomPanel : CoolExt.Panel
{
//some custom div we want to manipulate
private CustomDiv div = new CustomDiv();
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.ConfigCustomPanel();
}
//settings for panel
private void ConfigCustomPanel()
{
//panel settings
this.Width = Unit.Pixel(250);
this.Height = Unit.Pixel(250);
//add custom component to control
div.Html = "testing custom div";
this.ContentControls.Add(this.div);
}
//protected override void OnPreRender(EventArgs e)
//{
// //test function
// string fn = "Ext.Msg.alert('Confirm', String.format('You Clicked {0}', el.id));";
// //add function to custom div
// this.div.AddListener("click", "function(el){" + fn + "}");
// base.OnPreRender(e);
//}
}
public class CustomDiv : CoolExt.Component
{
public string Html
{
get
{
return (string)this.ViewState["Html"] ?? "";
}
set
{
this.ViewState["Html"] = value;
}
}
protected override void RenderContents(HtmlTextWriter writer)
{
if (!string.IsNullOrEmpty(this.Html))
{
writer.Write(this.Html);
}
base.RenderContents(writer);
}
//protected override void OnPreRender(EventArgs e)
//{
// //test function
// string fn = "Ext.Msg.alert('Confirm', String.format('You Clicked {0}', el.id));";
// //add function to div
// this.AddListener("click", "function(el){" + fn + "}");
// base.OnPreRender(e);
//}
}
}