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

Rad date picker calender pop problem

10 Answers 291 Views
Input
This is a migrated thread and some comments may be shown as answers.
Harry
Top achievements
Rank 1
Harry asked on 04 Nov 2009, 11:50 AM
hi...
i want to open calender popup of rad date picker on top side...how can i do this?????plz reply..... 

10 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 04 Nov 2009, 12:40 PM
Hello Harry,

The online demo shows how to pop the Calendar in all four directions via the PopupDirection property. Is there anything unclear?

For older RadControls versions you can do the same with some Javascript:

http://www.telerik.com/help/aspnet-ajax/calendar_howtodisplayingthepopupabovetheinputarea.html


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
Shinu
Top achievements
Rank 2
answered on 04 Nov 2009, 12:40 PM
Hi Harry,

Customizing the popup can be done by setting the popup direction explicitly from client side code in PopUpAbove event handler. You need to register the PopupAbove() event with DatePopupButton’s click attribute in order to get it execute on clicking the DatePopup button. Try the following code snippets.

CS:
 protected void Page_Load(object sender, EventArgs e) 
    { 
        RadDatePicker2.DatePopupButton.Attributes.Add("onclick""PopupAbove(event, '" + RadDatePicker1.ClientID + "');return false;");  
    } 




ASPX:
    <telerik:RadDatePicker ID="RadDatePicker2" runat="server"
    </telerik:RadDatePicker> 

JavaScript:
 
<script type="text/javascript"
    function PopupAbove(e, pickerID) { 
        var datePicker; 
        if (pickerID == null) { 
            datePicker = $find("<%= RadDatePicker2.ClientID %>"); 
        } 
        else { 
            datePicker = $find(pickerID); 
        }        datePicker.set_popupDirection(Telerik.Web.RadDatePickerPopupDirection.TopRight); // Set the popup direction to TopRight 
        datePicker.showPopup(); 
        datePicker.set_popupDirection(Telerik.Web.RadDatePickerPopupDirection.BottomRight); // Set the popup direction back to default (BottomRight) 
    } 
</script> 

-Shinu.
0
Harry
Top achievements
Rank 1
answered on 05 Nov 2009, 06:03 AM
sorry shinu sir...i use ur code but it shows error Telerik.Web.RadDatePickerOpenPopUp.TopRight is null not an object.......plz tell me solution of this error or any way to open date picker pop up on top side?????????
0
Shinu
Top achievements
Rank 2
answered on 05 Nov 2009, 07:22 AM
Hello Harry,

I guess you are not using the latest version of RadControls. I tried the code and it is working fine on my end with the latest version (2009.02.0826.35).

Give a try with the following code and see whether it helps in achieving the functionality?
JavaScript:
 
<script type="text/javascript"
function PopupAbove(e, pickerID)  
{  
    var datePicker;  
    if (pickerID == null)  
    {  
        datePicker = $find("<%= RadDatePicker1.ClientID %>");  
    }  
    else  
    {  
        datePicker = $find(pickerID); 
    } 
    var textBox = datePicker.get_textBox();  
    var popupElement = datePicker.get_popupContainer();      
    var dimensions = datePicker.getElementDimensions(popupElement);  
    var position = datePicker.getElementPosition(textBox);      
    datePicker.showPopup(position.x, position.y - dimensions.height);   
}  
</script> 

Could you provide the version of RadControls that you are using if this does not help?

-Shinu.
0
Harry
Top achievements
Rank 1
answered on 05 Nov 2009, 07:34 AM
hello shinu...
will u send me any  small source code example website
0
Harry
Top achievements
Rank 1
answered on 05 Nov 2009, 07:42 AM
thanks shinu .....
by this code i able to open the pop up on top side.......
but i want open pop up of RadDateTime picker according screen if below radDatePicker is less space then it open on top side and if above rad date picker is less space then it wil be open below side......
0
Dimo
Telerik team
answered on 05 Nov 2009, 09:09 AM
Hello Harry,

Since Q2 2009 SP1 RadDatePicker features screen boundary detection and pops automatically to the correct side. If you are using an older version, you will have to implement this functionality manually (see my previous message).

Kind regards,
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
Harry
Top achievements
Rank 1
answered on 07 Nov 2009, 08:18 AM
hello
by this example i able to open popup only in top direction....sir i want it should be adjustable according to screen.if bottom direction space is less then it open in top otherwise open in bottom................
0
Dimo
Telerik team
answered on 09 Nov 2009, 08:33 AM
Hello Harry,

Well, you have to calculate the size of the page (e.g. with $telerik.getViewPortSize() ), then the position of the picker's textbox on the page (e.g. use $telerik.getLocation() ) and then set the correct popup coordinates manually.

I recommend you to simply upgrade to the latest RadControls version and you will get the functionality out-of-the-box.

Sincerely yours,
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
Harry
Top achievements
Rank 1
answered on 11 Nov 2009, 04:40 AM
Hello...
is there any code available?????????????????
Tags
Input
Asked by
Harry
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Shinu
Top achievements
Rank 2
Harry
Top achievements
Rank 1
Share this question
or