FooterTempalte for Calendar in RadDatePicker

2 posts, 0 answers
  1. Maxim
    Maxim avatar
    2 posts
    Member since:
    Oct 2011

    Posted 18 Dec 2011 Link to this post

    Hello All.

    I have the following problem. The following code is not working. Everything that I want is to add RadButton control to FooterTemplate of the Calendar in RadDatePicker.

    <telerik:RadDatePicker runat="server" ID="TestPicker" >
        <Calendar  >
            <FooterTemplate>
                <telerik:RadButton runat="server" ID="RadButton1" Text="TestButton"></telerik:RadButton>
            </FooterTemplate>
        </Calendar>
    </telerik:RadDatePicker>

    As far as I know there should not be any problems with adding IScriptControl (web server controls with client side support) to template of any control (if this template is proper instantiated and created).

    The error which I received:

    Script control 'RadButton1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
    Parameter name: scriptControl

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: Script control 'RadButton1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
    Parameter name: scriptControl

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [ArgumentException: Script control 'RadButton1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
    Parameter name: scriptControl]
       System.Web.UI.ScriptControlManager.RegisterScriptDescriptors(IScriptControl scriptControl) +442251
       System.Web.UI.ScriptManager.RegisterScriptDescriptors(IScriptControl scriptControl) +49
       Telerik.Web.UI.RadWebControl.RegisterScriptDescriptors() +66
       Telerik.Web.UI.RadWebControl.Render(HtmlTextWriter writer) +119
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
       System.Web.UI.Control.Render(HtmlTextWriter writer) +10
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       Telerik.Web.UI.RadCalendar.WriteHtmlContent(HtmlTextWriter writer) +4583
       Telerik.Web.UI.RadCalendar.Render(HtmlTextWriter writer) +423
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       Telerik.Web.UI.RadDatePicker.AddControlComponents(HtmlTextWriter writer) +346
       Telerik.Web.UI.RadDatePicker.RenderChildren(HtmlTextWriter writer) +1584
       System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
       Telerik.Web.UI.RadWebControl.RenderContents(HtmlTextWriter writer) +165
       Telerik.Web.UI.RadDatePicker.RenderContents(HtmlTextWriter writer) +49
       System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
       Telerik.Web.UI.RadWebControl.Render(HtmlTextWriter writer) +91
       Telerik.Web.UI.RadDatePicker.Render(HtmlTextWriter writer) +143
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
       System.Web.UI.Control.Render(HtmlTextWriter writer) +10
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
       System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +173
       System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +31
       System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
       System.Web.UI.Control.Render(HtmlTextWriter writer) +10
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
       System.Web.UI.Page.Render(HtmlTextWriter writer) +29
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +823
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
       System.Web.UI.Page.Render(HtmlTextWriter writer) +29
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +823
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
       System.Web.UI.Page.Render(HtmlTextWriter writer) +29
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060
    

    Please let me know if I can put IScriptControl controls to the Footer Template of the calendar control. And if not, then can you please explain why i can't do such things.

    Thank you in advance.
  2. Maxim
    Maxim avatar
    2 posts
    Member since:
    Oct 2011

    Posted 18 Dec 2011 Link to this post

    It seems that I found the cause of the problem (by using Reflector).

    The cause of the problem is in RadCalendar control. It is awesome but Footer Template at first is instantiated, then in PreRender event Footer Template Container is hiding (by setting Visible property to false) and then Footer Template Container is rendered in Render method.

    So, to overcome problem I set RegisterWithScriptManager property of the Rad controls placed to the Footer Template to false.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top