views:

43

answers:

1

How do I add the out-of-the-box SharePoint date filter webpart to an ASP.Net web page?

I want to do it either in an ASPX...

<%@ Register Assembly="<DateFilterDLL??>" Namespace="<??>" TagPrefix="DP" %>
<...>
        <asp:WebPartManager ID="WebPartManager1" runat="server">
        </asp:WebPartManager>
<...>
 <ZoneTemplate>
        <DP:<DateFilterWebPart??> ID="DateFilter" runat="server" />

or programmatically, in the ASPX.CS

protected void Page_Load(object sender, EventArgs e)
{
 this.Controls.Add(<Microsoft.Something.DatePicker??>
}
+1  A: 

In your code behind add a reference to Microsoft.Sharepoint and Microsoft.Sharepoint.WebControls

Then declare DateTimeControl dtc;

In your page Load or Page Init just use dtc=new DateTimeControl(); this.Controls.Add(dtc);

This should add the datecontrol. Let me know if u face some issue

Abhishek Rao
Thanks, but doesn't that only add a DateTime control to a web part? And then you have to add the methods and attributes to turn the web part into a filter? However, there's alread a Date Time filter web part in sharepoint. I'm trying to add it to an ASPX page (pls see my first aspx page - it's an aspx page set up to accept webpart controls, and I want to add the DateTime filter web part to it).
Javaman59