Hello
I'm doing a hide webpart function. This webpart will only un-hide on the date specified. I want to use a datetimepicker/ datetimecontrol to allow the user to specify a date. Anybody knows how to go about coding this preferably c# codings?
I'm giving my best for my Final Year Project. Your guide would be very much appreciated.
Thank You.
Loading
Sharmila RahimPosted Aug 6, 2009, 2:53 AM
could you explain how the code is implemented? I've tried but there's errors. I could have implemented it wrongly. I really want to get this working. I hope you could help me in this.
Thank you.
Sharmila RahimPosted Aug 4, 2009, 2:41 AM
its part of Microsoft.Sharepoint.WebControls
//Date Time Control
protected DateTimeControl dtcPublishStartDate;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
EnsureChildControls();
dtcPublishStartDate.Calendar = SPCalendarType.Gregorian; // Setup the Calander Type
dtcPublishStartDate.LocaleId = 1037; // Setup your Location Id , 1037 = Israel
}
and on WP Prerender do this
// start date
if (!dtcPublishStartDate.IsDateEmpty)
{
if(dtcPublishStartDate.SelectedDate.ToString("yyyy-MM-ddThh:mm:ssZ") >=DateTime.Today.ToString("yyyy-MM-ddThh:mm:ssZ")
{
this.Visible = true
}
}
Hello again. The above codings is to be placed in a .cs in visual studio 2005?
Roei BarPosted Aug 4, 2009, 2:32 AM
Sharepoint is devided into 2 enviorments the Authoring one and the delivery one that is the one that the End User actualy looking on, i asked that since, you can create this on the page basis, as a publishing date for the page to change...
Sharmila RahimPosted Aug 4, 2009, 2:25 AM
is this webpart on the delivery enviorment prior to the time it needs to be delivered?"
1) Yes. The webpart is available on the date that it was specified.
2) Delivery environment? This webpart is available at the Home page of the Sharepoint Portal. Thus when the day falls on the date, the webpart is visible else it's not visible.
Roei BarPosted Aug 4, 2009, 2:18 AM
its part of Microsoft.Sharepoint.WebControls
//Date Time Control
protected DateTimeControl dtcPublishStartDate;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
EnsureChildControls();
dtcPublishStartDate.Calendar = SPCalendarType.Gregorian; // Setup the Calander Type
dtcPublishStartDate.LocaleId = 1037; // Setup your Location Id , 1037 = Israel
}
and on WP Prerender do this
// start date
if (!dtcPublishStartDate.IsDateEmpty)
{
if(dtcPublishStartDate.SelectedDate.ToString("yyyy-MM-ddThh:mm:ssZ") >=DateTime.Today.ToString("yyyy-MM-ddThh:mm:ssZ")
{
this.Visible = true
}
}
i think this should do the trick
Roei BarPosted Aug 4, 2009, 2:06 AM
is this webpart on the delivery enviorment prior to the time it needs to be delivered?