简体   繁体   English

telerik:RadCalendar不专注于设置日期

[英]telerik:RadCalendar does not focus on set date

I'm using a RadCalendar on a WebForm. 我在WebForm上使用RadCalendar。 this is my RadCalendar: 这是我的RadCalendar:

 <telerik:RadCalendar RenderMode="Lightweight" ID="RadCalendar1" Width="100%"
 EnableMultiSelect="false" EnableKeyboardNavigation="true"
 ShowColumnHeaders="true" ShowDayCellToolTips="true" ShowRowHeaders="true" runat="server">
 <FastNavigationSettings EnableTodayButtonSelection="true">
<ShowAnimation Type="Slide" Duration="2" /></FastNavigationSettings></telerik:RadCalendar>

I want to set RadCalendar from a DataTable using c#. 我想使用c#从数据表中设置RadCalendar。 I could succeed in my purpose using following code on Page_Load : 我可以在Page_Load上使用以下代码来达到目的:

    if (!IsPostBack)
    {
         DataTable dt = cls.PhotoFetchById(ViewState["photoId"].ToString());
         if (dt.Rows.Count > 0)
          {
              string date = dt.Rows[0]["phDate"].ToString();
              RadCalendar1.SelectedDate = DateTime.Parse(date);

          }
    }

The problem is RadCalander always show current month page and if the set date is no place in current month page, it's never shown on page loading. 问题是RadCalander始终显示当前月份页面,并且如果设置日期在当前月份页面中没有位置,则永远不会在页面加载中显示。
For example, if the set date is "2013-02-12" but the current date is "2018/11/23", RadCalendar always show current month page without any selected day. 例如,如果设置日期为“ 2013-02-12”,而当前日期为“ 2018/11/23”,则RadCalendar始终显示当前月份页面,而没有任何选定的日期。

It looks you also need to set FocusedDate to your date as well. 看起来您还需要将FocusedDate设置为您的日期。

Source 资源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Telerik RadCalendar着重于1个以上日期 - Telerik RadCalendar set focus on more than 1 dates Telerik RadCalendar ASP.NET控件重置日期 - Telerik RadCalendar ASP.NET control reset date 设置RadNumericBox Focus Telerik WPF的属性 - Property to Set RadNumericBox Focus Telerik WPF 如何在Telerik RadTreeView中设置SelectedNode和设置选中节点的Focus? - How to set the SelectedNode and Set the Focus of the selected node in Telerik RadTreeView? UWP CalenderView设置日期和焦点 - UWP CalenderView Set Date And Focus 为什么在这种情况下调用Focus()不会设置焦点? - Why does calling Focus() not set focus in this instance? 在JavaScript中另一个Telerik datepicker的onChange事件上设置Telerik Datepicker的最小日期 - Set the min date of Telerik Datepicker on onChange event of another Telerik datepicker in javascript 为什么在OnNavigatedTo()事件中设置焦点没有设置焦点? - Why does setting focus in the OnNavigatedTo() event not set focus? telerik radgrid-如何在单击“添加新记录”按钮以添加记录后将页面焦点设置为“插入”按钮 - telerik radgrid - how do I set the page focus to the insert button after clicking the add new record button to add a record Telerik BusyIndi​​cator不显示 - Telerik BusyIndicator does not Display
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM