May 28, 2013, 11:59 AM
Also the following can help.
Example
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
btnCreate.SuspendScripting();
btnCreate.Hidden = true;
btnCreate.ResumeScripting();
}
protected override void OnPreRender(EventArgs e)
{
base.OnLoad(e);
btnCreate.SuspendScripting();
btnCreate.Hidden = false;
btnCreate.ResumeScripting();
}
If a control is designed to be used with Ext.NET and that control is going to be recreated during an Ext.NET AJAX request (DirectEvent or DirectMethod), you should suspend scripting for all property changes during the whole control life cycle starting from "base.onInit(e)" (see the example below). It is aslo actual for a control's child controls (as demonstrated in the example above).Example
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
this.SuspendScripting();
this.Hidden = true;
this.ResumeScripting();
}
"starting from "base.onInit(e)" means that you can initialize the control's (and its chilldren's) properties within a control's constructors or prior to "base.OnInit(e)" call without suspending of scripting.