I am not sure exactly by your error but here is what I can offer..
The event module is a two part system, I dont know for sure if you need to extend both in order for it to work..
I know my code is outdated because there a table change in a newer version of MonoX that breaks the code but thats a minor fix..
There is a post on the forum somewhere about how to fix this.. not had a chance to add that just yet.. but i am posting the old code below of both parts which may help you.
The MonoX guys helped me a lot with this..
I was trying to change the sort order of the event module.
EventModuleExt.cs
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
MonoSoftware.MonoX.Utilities;
using
MonoSoftware.MonoX.ModuleGallery;
using
MonoSoftware.MonoX;
namespace
WebParts.EventModuleExt
{
[WebPartCatalogCategory(
"CustomExt"
)]
public
partial
class
EventModuleExt : MonoSoftware.MonoX.ModuleGallery.EventModule
{
private
DateTime _selectedDay = DateTime.Now;
/// <summary>
/// Gets or sets selected day so you can easily change day you want to show
/// </summary>
public
DateTime SelectedDay
{
get
{
return
_selectedDay; }
set
{
_selectedDay = value;
}
}
protected
override
void
OnInit(EventArgs e)
{
this
.Title =
"Event Module - Ascending"
;
base
.OnInit(e);
// We can switch mode to simple as we're not interested in advanced mode in this case
Mode = MonoSoftware.MonoX.ModuleGallery.EventModuleMode.Simple;
// No point in showing the filter
ctlSimpleView.ShowFilter =
false
;
}
public
override
void
DataBind()
{
// Before we bind data we need to set day we want to show
((EventSimpleViewExt)ctlSimpleView).SelectedDay =
this
.SelectedDay;
base
.DataBind();
}
}
}
EventSimpleViewExt.cs
using
System;
using
System.Collections.Generic;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
MonoSoftware.MonoX.ModuleGallery;
using
MonoSoftware.MonoX.Controls;
using
SD.LLBLGen.Pro.ORMSupportClasses;
using
MonoSoftware.MonoX.DAL.HelperClasses;
using
MonoSoftware.MonoX.DAL.EntityClasses;
using
MonoSoftware.MonoX.Repositories;
using
MonoSoftware.MonoX.Utilities;
namespace
WebParts.EventModuleExt
{
public
partial
class
EventSimpleViewExt : MonoSoftware.MonoX.ModuleGallery.EventSimpleView
{
//prevent bug... remove next version..
protected
override
void
OnLoad(EventArgs e)
{
// TODO: Uncomment this line when MonoX is upgraded
base
.OnLoad(e);
}
/// <summary>
/// Gets or sets day to display
/// </summary>
public
DateTime SelectedDay {
get
;
set
; }
public
override
void
DataBind()
{
// Fetch filter, we can ignore module filter in this case as we have full control over fetching
IRelationPredicateBucket filter =
new
RelationPredicateBucket();
filter.PredicateExpression.Add(CalendarEventFields.Id ==
this
.CalendarId);
// filter.PredicateExpression.Add(CalendarEventFields.CalendarId == this.CalendarId);
// filter.PredicateExpression.Add(CalendarEventFields.StartTime >= this.SelectedDay.Date);
// filter.PredicateExpression.Add(CalendarEventFields.StartTime < this.SelectedDay.Date.AddDays(1));
// Set sorter, here you'll change sort direction by changing SortOperator
ISortExpression sorter =
new
SortExpression(
new
SortClause(CalendarEventFields.StartTime,
null
, SortOperator.Ascending));
EntityCollection<CalendarEventEntity> items =
new
EntityCollection<CalendarEventEntity>();
BaseMonoXRepository.GetInstance().FetchEntityCollection(items, filter, 0, sorter,
null
, pager.CurrentPageIndex + 1, pager.PageSize);
int
recordCount = BaseMonoXRepository.GetInstance().GetDbCount(items, filter);
PagerUtility.BindPager(pager, DataBind, lvItems, items, recordCount);
}
}
}