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

How to Show/Hide RadDatePicker Clientside

6 Answers 626 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Brijendra Kumar
Top achievements
Rank 1
Brijendra Kumar asked on 25 May 2009, 12:48 PM
Dear All,

Please tell me how to show/hide raddatepicker clientside using javascript.


Thanks & regards
Brijendra Pandey

6 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 25 May 2009, 01:53 PM
Hello Brijendra,

Try the following code-snippet:
var dp = $find('<%= RadDatePicker1.ClientID %>'); 
dp.get_element().parentNode.style["display"] = "none"

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Luke
Top achievements
Rank 1
answered on 07 Dec 2009, 02:03 PM
Hi! In my case I'm not able to hide the RadDatePicker anyway. I have to hide it from the JS file related to the ascx page and I tried by using several methods:
firstly I instantiated the variable «picker» with $find("ctl00_CPHBody_TCNOfferta_TPNLOfferta_FRVOfferta_RDPDataOfferta")
then picker.get_element().parentNode.style["display"] = "none", but it does nothing, the picker is always there.
So I tried another method: I searched for the object by using «document.getElementById(...)» and I tried to modify the style: picker.style.display = 'none' and nothing again. I tried picker.style.visibility = 'hidden', but same story that is nothing happens. I also tried GetClientID(...) and the previous commands, but... try to find out by yourself... nothing again! The nice DatePicker is lovely always there.

I'm a little bit frustrated, are you able to get why it does not work what I'm trying to do?
0
Dimo
Telerik team
answered on 07 Dec 2009, 02:54 PM
Hello Luke,

 Here is a demo, which will work with all versions of RadDatePicker for ASP.NET AJAX. In the Q3 2009 SP1 version (which will be released later this week), the set_visible() client method will be supported.


<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls for ASP.NET AJAX</title>
<style type="text/css">
 
.hideMe
{
    display:none !important;
}
 
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<asp:Button ID="Button2" runat="server" Text="Hide" OnClientClick="return hide()" />
<asp:Button ID="Button1" runat="server" Text="Show" OnClientClick="return show()" />
 
<br /><br />
 
<telerik:RadDatePicker ID="RadDatePicker1" runat="server" />
 
<script type="text/javascript">
 
function hide()
{
    var pickerWrapper = $get("<%= RadDatePicker1.ClientID %>_wrapper");
    if (pickerWrapper.className.indexOf("hideMe") == -1)
        pickerWrapper.className += " hideMe";
         
    return false;
}
 
function show()
{
    var pickerWrapper = $get("<%= RadDatePicker1.ClientID %>_wrapper");
    pickerWrapper.className = pickerWrapper.className.replace("hideMe", "");
     
    return false;
}
 
</script>
 
</form>
</body>
</html>


Greetings,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Pradeep
Top achievements
Rank 1
answered on 28 Jun 2018, 06:44 AM

Kindly give me the script which will show/hide the RadCalendarcontrol on button click or when i click outside the control it should close.

0
Pradeep
Top achievements
Rank 1
answered on 28 Jun 2018, 06:45 AM

Dear All,

Kindly give me the show hide of Rad Calandar control at client side.

 

Thanks,
Pradeep

0
Eyup
Telerik team
answered on 02 Jul 2018, 06:11 AM
Hi Pradeep,

You can achieve this requirement using the following approach:
function buttonClick() {
    var calendar = $find('<%= RadCalendar1.ClientID %>');
    calendar.set_visible(!calendar.get_visible());
}

I hope this will prove helpful.

Regards,
Eyup
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Calendar
Asked by
Brijendra Kumar
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Luke
Top achievements
Rank 1
Dimo
Telerik team
Pradeep
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or