Rad date picker calender pop problem

11 posts, 0 answers
  1. Harry
    Harry avatar
    27 posts
    Member since:
    Mar 2009

    Posted 04 Nov 2009 Link to this post

    hi...
    i want to open calender popup of rad date picker on top side...how can i do this?????plz reply..... 
  2. Dimo
    Admin
    Dimo avatar
    8479 posts

    Posted 04 Nov 2009 Link to this post

    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.
  3. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Nov 2009 Link to this post

    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.
  4. Harry
    Harry avatar
    27 posts
    Member since:
    Mar 2009

    Posted 05 Nov 2009 Link to this post

    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?????????
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 Nov 2009 Link to this post

    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.
  6. Harry
    Harry avatar
    27 posts
    Member since:
    Mar 2009

    Posted 05 Nov 2009 Link to this post

    hello shinu...
    will u send me any  small source code example website
  7. Harry
    Harry avatar
    27 posts
    Member since:
    Mar 2009

    Posted 05 Nov 2009 Link to this post

    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......
  8. Dimo
    Admin
    Dimo avatar
    8479 posts

    Posted 05 Nov 2009 Link to this post

    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.
  9. Harry
    Harry avatar
    27 posts
    Member since:
    Mar 2009

    Posted 07 Nov 2009 Link to this post

    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................
  10. Dimo
    Admin
    Dimo avatar
    8479 posts

    Posted 09 Nov 2009 Link to this post

    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.
  11. Harry
    Harry avatar
    27 posts
    Member since:
    Mar 2009

    Posted 10 Nov 2009 Link to this post

    Hello...
    is there any code available?????????????????
Back to Top