This is a migrated thread and some comments may be shown as answers.

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

2 Answers 118 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 31 Dec 2007, 06:18 AM
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 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 03 Jan 2008, 05:13 PM
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
0
Mark
Top achievements
Rank 1
answered on 03 Jan 2008, 11:43 PM
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
Tags
Calendar
Asked by
Mark
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Mark
Top achievements
Rank 1
Share this question
or