1

我有一个 asp 形式的共享点 DateTimeControl,但是下拉框不显示任何值。

 <td class="ms-formbody">
    <SharePoint:DateTimeControl ID="dateTimeCurfewIn" runat="server" TimeOnly="true" HoursMode24="true"/>
 </td>

我需要添加一些特别的东西来获得在下拉框中显示的时间吗?

4

2 回答 2

2

你的例子有效。也许尝试添加

<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 

如果你以前没有。这里DateTimeControl 控件是完整的控件属性描述。

祝你好运。

于 2012-08-10T19:25:39.037 回答
0

这是一个常见的方法,希望它可以帮助有同样问题的人。

/// <summary>
/// Get common SP DateTimeControl with current DateOnly settings and MethodToProcessDateChanged
/// </summary>
public static DateTimeControl Cd(this bool DateOnly, bool AutoPostBack = false,
DateTime? SelectedDate = null, Func<bool> MethodToProcessDateChanged = null)
{
     var d = new DateTimeControl();
     d.DateOnly = DateOnly;
     d.AutoPostBack = AutoPostBack;
     if (SelectedDate != null)
     d.SelectedDate = SelectedDate.Value;
     if (MethodToProcessDateChanged != null)
          d.DateChanged += (o, e) => { MethodToProcessDateChanged();};
     return d;
}

在此处查看更多详细信息

于 2019-03-14T13:41:56.460 回答