Asp.net asp表单中的DateTimeControl空白

Asp.net asp表单中的DateTimeControl空白,asp.net,sharepoint-2010,Asp.net,Sharepoint 2010,我有一个asp表单中的sharepoint DateTimeControl,但是下拉框不显示任何值 <td class="ms-formbody"> <SharePoint:DateTimeControl ID="dateTimeCurfewIn" runat="server" TimeOnly="true" HoursMode24="true"/> </td> 有什么特别的东西我需要添加到这里来获得在下拉框中显示的时间吗?您的示例很有效。也

我有一个asp表单中的sharepoint DateTimeControl,但是下拉框不显示任何值

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


有什么特别的东西我需要添加到这里来获得在下拉框中显示的时间吗?

您的示例很有效。也许可以尝试添加

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

如果你以前没有。下面是控件属性的完整描述


祝你好运。

这里有一个常用的方法,希望它能帮助有同样问题的人

/// <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;
}
//
///使用当前的DateOnly设置和MethodToProcessDateChanged获取公共SP DateTimeControl
/// 
公共静态DateTimeControl Cd(此bool DateOnly,bool AutoPostBack=false,
DateTime?SelectedDate=null,Func MethodToProcessDateChanged=null)
{
var d=新的DateTimeControl();
d、 DateOnly=DateOnly;
d、 自动回邮=自动回邮;
如果(SelectedDate!=null)
d、 SelectedDate=SelectedDate.Value;
如果(MethodToProcessDateChanged!=null)
d、 DateChanged+=(o,e)=>{MethodToProcessDateChanged();};
返回d;
}
查看更多详细信息