DateTimeControl以asp形式呈现空白

问题描述 投票:0回答:2

我有一个asp形式的sharepoint DateTimeControl,下拉框没有显示任何值。

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

我需要添加一些特殊内容以便在下拉框中显示时间吗?

asp.net sharepoint-2010
2个回答
1
投票

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

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

如果你之前没有。这里DateTimeControl Control是完整的控制属性描述。

祝好运。


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

© www.soinside.com 2019 - 2024. All rights reserved.