I am creating a script control for asp.net Ajax, and while I can get the function GetScriptReferences()that I call, I cannot get GetScriptDescriptors().
I tried to get by ScriptControl, ScriptControlBase, IScriptControl. I am registering a control using the page manager script, but I still cannot get this function to be called?
Any ideas on what I might have missed?
public class FilterGroupingControl : CompositeControl, IScriptControl
{
public List<FilterGrouping> Groupings { get; set; }
public FilterGroupingControl()
{
this.Groupings = new List<FilterGrouping>();
}
protected override void OnPreRender(EventArgs e)
{
#region register control with script manager
ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
if (scriptManager == null)
throw new InvalidOperationException("There must be a script manager on the page");
scriptManager.RegisterScriptControl(this);
#endregion
base.OnPreRender(e);
}
public IEnumerable<ScriptDescriptor> GetScriptDescriptors()
{
throw new InvalidOperationException();
ScriptControlDescriptor d = new ScriptControlDescriptor("Web.UI.Controls.FilterGroupingControl", this.ClientID);
d.AddProperty("Groupings", this.Groupings.ToArray());
return new ScriptDescriptor[] { d };
}
public IEnumerable<ScriptReference> GetScriptReferences()
{
return new ScriptReference[0];
}
}
source
share