Hi,
I'm building a script control for asp.net Ajax, and while i can get the GetScriptReferences() function to be called, i cannot get the GetScriptDescriptors().
I've tried deriving from ScriptControl, ScriptControlBase, IScriptControl. I'm registering the control with the pages script manager, but i still cannot get the 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()
{
// throw new InvalidOperationException();
return new ScriptReference[0];
}
}