Welcome to the Community Exchange, a place where community members can exchange questions and answers related to DotNetNuke. If you would like more info about the Community Exchange, please visit this page in our Wiki.
I am new to DNN, and have built my first site with custom skins, containers & modules. For the most part I have figured out the issues I have ran into....except one. I followed the DotNetNuke Explained video on creating a module, watched all of the Task Manager series, downloaded and used the Visual Studio Module template and even dowloaded and read through the Task Manager code.
After writing my module, everything works great except the CreatedOnDate and LastModifiedOnDate fields are both giving me a null date (1/1/0001). Both dates are being written to the database with no problem and the LastModifiedOnDate is even being updated when I update my content object.
My content Object is ADTVVideo which inherits from ContentItem Which inherits from BaseEntityInfo. BaseEntityInfo has CreatedOnDate/LastModifiedOnDate fields but they are read only and don't seem to do anything. The module template has new fields created for these values. In my ADTVVideo class I have an override of the Fill method that calls the base method then fills the fields I created from the datareader. All of my fields populate except for the two dates. My fill code contains:
CreatedOnDate = Null.SetNullDateTime(dr["CreatedOnDate"]); LastModifiedOnDate = Null.SetNullDateTime(dr["LastModifiedOnDate"]);
Yet when I read my two fields they both contain the null date. Any ideas?
at a glance that should work, however we use a different pattern -rather than doing the individual columns in the overriden fill method (the IHydratable implementation), we call the FillInternal method of BaseEntityInfo e.g.
public override void Fill(IDataReader dr) { //Call the base classes fill method to populate base class properties base.FillInternal(dr);
//now fill other fields e.g.
//ModuleTitle = Null.SetNullString(dr["ModuleTitle"]);
//etc.
}
You have already flagged this post. Clicking "Remove Flag" below will remove your flag, thus reducing the count by one as well.