我编写了一个自定义控件,其中包含以下内容:
[assembly: System.Web.UI.WebResource("InSysControls.AssignmentLists.AssignmentLists.js", "text/javascript")]
namespace InSysControls
{
[ToolboxData("<{0}:AssignmentLists ID='AssignmentListsID' runat=\"server\"> </{0}:AssignmentLists>"), ParseChildren(true, "Items")]
public class AssignmentLists : CompositeDataBoundControl, IScriptControl, INamingContainer
{
#region IScriptControl Members
public IEnumerable<ScriptDescriptor> GetScriptDescriptors() {
ScriptControlDescriptor descriptor = new ScriptControlDescriptor(this.GetType().FullName, this.ClientID);
yield return descriptor;
}
public IEnumerable<ScriptReference> GetScriptReferences() {
yield return new ScriptReference("InSysControls.AssignmentLists.AssignmentLists.js", "InSysControls");
}
#endregion
}
}
有谁知道为什么不应该调用 GetScriptDescriptors 或 GetScriptReferences 的原因?控制的其他部分工作得很好。