When using RadDatePicker inside RadGrid Prometheus I can't find Enable/Disable Javascript functionality

3 posts, 0 answers
  1. Mark
    Mark avatar
    97 posts
    Member since:
    Nov 2007

    Posted 31 Dec 2007 Link to this post

    Hi

    I'm using VS2008, .NET 3.5 and C#.

    I use RadDatePickers inside a Prometheus RadGrid. I can successfully reference these RadDatePickers in Javascript and can perform functions like GetMinDate().

    However in 

    ms-help://telerik.radcontrols.prometheus.2007.Q3/telerik.radcontrols.prometheus.2007.Q3/cldClientSideAPI.html

    there is functionality for enabling / disabling this control which isn't working for me. Basically it can't find "DateInput" and "PopupButton".

    Please let me know if you require an further information.


    Kind regards

    Mark Eaton

  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 03 Jan 2008 Link to this post

    Hello Mark,

    It seems that the help article has not been updated properly for the Prometheus version of our controls. We will do that for the Q3 2007 SP1 version of our controls, expected in the middle of this month. For your convenience I am pasting the modified code snippet in this support thread:

                <asp:ScriptManager ID="ScriptManager1" runat="server">  
                </asp:ScriptManager> 
                <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">  
     
                    <script type="text/javascript">  
                    var isPopupOpening = true;  
                      
                    function disable()  
                    {  
                        var datepicker = $find("<%=RadDatePicker1.ClientID %>");  
                        $get(datepicker.get_dateInput().get_id() + "_text").disabled = "disabled";  
                        isPopupOpening = false;  
                    }  
     
                    function enable()  
                    {  
                        var datepicker = $find("<%=RadDatePicker1.ClientID %>");  
                        $get(datepicker.get_dateInput().get_id() + "_text").disabled = "";  
                        isPopupOpening = true;  
                    }  
                      
                    function PopupOpening(sender, args)  
                    {  
                        if(!isPopupOpening)  
                        {  
                          args.set_cancel(true);  
                        }  
                    }  
                    </script> 
     
                </telerik:RadScriptBlock> 
                <telerik:RadDatePicker ID="RadDatePicker1" runat="server">  
                    <ClientEvents OnPopupOpening="PopupOpening" /> 
                </telerik:RadDatePicker> 
                <br /> 
                <href="javascript:disable();">Disable</a> <href="javascript:enable();">Enable</a> 

    A sample project is enclosed to this forum post for further reference.

    Best regards,
    Stephen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Mark
    Mark avatar
    97 posts
    Member since:
    Nov 2007

    Posted 03 Jan 2008 Link to this post

    Hi

    Thanks for the reply, it put me on the right track. As I'm in a grid, instead of using a variable I checked if the DatePicker was enabled. E.g.

    function

    dateTo_PopupOpening(sender, e)
    {
        // If the RadDateInput is disabled then we want to prevent the calendar popup
        if($get(sender.get_dateInput().get_id() + "_text").disabled)
            e.set_cancel(
    true);
    }


    Now works beautifully!

    Thanks again.


    Kind regards

    Mark Eaton
Back to Top