Calendar in ComboBox

2 posts, 0 answers
  1. Raymond Mui
    Raymond Mui avatar
    54 posts
    Member since:
    Apr 2008

    Posted 06 May 2008 Link to this post

    I tried to run the demo of the following page

    http://www.telerik.com/demos/aspnet/prometheus/ComboBox/Examples/Default/DefaultCS.aspx

    When I click the calendar navigation button to other months, the comboBox collapse and needed to be clicked again to show the calendar.  Besides, the comboBox text becomes a string of text.

    It seems to be a limitation to use Calendar in ComboBox?!?

  2. Rosi
    Admin
    Rosi avatar
    2529 posts

    Posted 07 May 2008 Link to this post

    Hi Raymond Mui,

    I suggest you to wrap the calendar in a div as following:

    <ItemTemplate> 
      <div id="div1">  
                            <telerik:RadCalendar ID="RadCalendar1" runat="server" TitleFormat="MMMM yyyy" Skin="Vista" style="margin: 0 auto;" 
                                ShowRowHeaders="false" OnSelectionChanged="Calendar_HouseTourDate_SelectionChanged" AutoPostBack="true" ClientEvents-OnDateClick="OnDateClick" ClientEvents-OnDateSelecting="OnDateSelecting" EnableMultiSelect="false" > 
                            </telerik:RadCalendar> 
     </div  
    </ItemTemplate> 
     

    Then you can hook click event of the div and stop propagation of browser event when the div is clicked. To do so you can just put the following code after RadComboBox definition.

     <script type="text/javascript">  
                    var div1 = document.getElementById("div1");  
                    div1.onclick = StopPropagation;  
     
            function StopPropagation(e)  
             {  
                 if(!e)  
                 {  
                     e = window.event;  
                 }  
                       
                 e.cancelBubble = true;  
             }          
     
     </script>  
     

    Regards,
    Rosi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top