我在asp表单中有一个sharepoint DateTimeControl,但是下拉框没有显示任何值。
<td class="ms-formbody">
<SharePoint:DateTimeControl ID="dateTimeCurfewIn" runat="server" TimeOnly="true" HoursMode24="true"/>
</td>
我需要添加一些特殊内容以便在下拉框中显示时间吗?
答案 0 :(得分:1)
你的例子有效。也许尝试添加
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
如果你之前没有。这里DateTimeControl Control已填满控件属性说明。
祝你好运。答案 1 :(得分: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;
}
查看更多详细信息here