This project is read-only.

InvalidCastException ContentItem Metadata \Taxonomy\Content.cs:line 86

Feb 2, 2012 at 12:05 AM

Greetings. Thanks for this great module! I'm getting an exception when I update an Article. I'm just wondering if it is a known error. Thanks!

Namespace: DotNetNuke.Modules.dnnsimplearticle.Components.Taxonomy
Class: Content
Method: UpdateContentItem
Statement: var md = Util.GetContentController().GetContentItem(objContent.ContentItemId).Metadata

Error
DotNetNuke.Services.Exceptions.PageLoadException: Unable to cast object of type 'System.Int32' to type 'System.String'. ---> System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.String'.
   at System.Data.SqlClient.SqlBuffer.get_String()
   at System.Data.SqlClient.SqlDataReader.GetString(Int32 i)
   at DotNetNuke.Entities.Content.ContentController.GetMetaData(Int32 contentItemId)
   at DotNetNuke.Entities.Content.Common.ContentExtensions.GetMetaData(ContentItem item, Int32 contentItemId)
   at DotNetNuke.Entities.Content.ContentItem.get_Metadata()


   at DotNetNuke.Modules.dnnsimplearticle.Components.Taxonomy.Content.UpdateContentItem(Article objArticle, Int32 tabId) in K:\Websites\COMTest\DNN\DesktopModules\dnnsimplearticle\Components\Taxonomy\Content.cs:line 86

   at DotNetNuke.Modules.dnnsimplearticle.Components.ArticleController.SaveArticle(Article a, Int32 tabId) in K:\Websites\COMTest\DNN\DesktopModules\dnnsimplearticle\Components\ArticleController.cs:line 95

   at DotNetNuke.Modules.dnnsimplearticle.Edit.LbSaveClick(Object sender, EventArgs e) in K:\Websites\COMTest\DNN\DesktopModules\dnnsimplearticle\Edit.ascx.cs:line 124

   at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)

   at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)

   at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

   --- End of inner exception stack trace

Feb 2, 2012 at 12:42 AM

what version are you on? looks like you are on an oldversion of dnn and the module

Feb 2, 2012 at 12:50 AM
Christoc wrote:

what version are you on? looks like you are on an oldversion of dnn and the module

Thanks Chris.

DNN : 06.01.02 Community
DNNSimpleArticle : v00.01.00  

Please let me know if that is not enough info. I just downloaded the module today.
I do notice a comment in the module code:

                //testing meta data code
                var md = Util.GetContentController().GetContentItem(objContent.ContentItemId).Metadata;

Not sure what that means, but perhaps you do. Thanks again!

Feb 2, 2012 at 1:07 AM

Upon further investigation I see I downloaded the source code dnnsimplearticle-13922. At this point my next step would be to grab your 09 source code release. I think I downloaded the wrong code...

Feb 2, 2012 at 1:41 AM

Yeah, you grabbed code that isn't released yet ;)

 

DotNetNuke 6.1.3 (out today) should address that issue, but I haven't tested the module against it yet. hopefully in the next couple of weeks.

Feb 2, 2012 at 1:53 AM
christoc wrote:

Yeah, you grabbed code that isn't released yet ;)

 

DotNetNuke 6.1.3 (out today) should address that issue, but I haven't tested the module against it yet. hopefully in the next couple of weeks.

 

Indeed. Well... at least we've identified the potential issue now :)

Thank you Chris for your contributions and for this module in particular. New to DNN, custom module development examples were lacking (in my opinion) until I found your DNNSimpleArticle. Thanks again.  

Feb 2, 2012 at 4:53 AM

Check out the 25 part tutorial on the Module Development Wiki as well

 

http://www.dotnetnuke.com/Resources/Wiki/Page/Module-Development.aspx

Feb 2, 2012 at 10:51 PM
christoc wrote:

Check out the 25 part tutorial on the Module Development Wiki as well

 

http://www.dotnetnuke.com/Resources/Wiki/Page/Module-Development.aspx

Thanks Chris.

I'm curious: Do you have any tutorials on how to compile your DNNSimpleArticle_00.00.09_Source? I've followed the msi/template tut with success, and I've obviously compiled the dnnsimplearticle-13922 latest release, but I'm having trouble finding a version of the DNNSimpleArticle_Source that will compile.   

Feb 2, 2012 at 10:57 PM

You should be able to download the v00.00.09 source package. Upload it to your DotNetNuke development environment, open the SLN and compile.

 

What are you running into?

Feb 2, 2012 at 11:15 PM
christoc wrote:

You should be able to download the v00.00.09 source package. Upload it to your DotNetNuke development environment, open the SLN and compile.

 

What are you running into?

 

I'm using the DNNSimpleArticle_00.00.09_Source
http://dnnsimplearticle.codeplex.com/releases/view/68761

This zip contains a "Resources" zip with the SLR; however, the .dnn and Providers files need to be moved into the unzipped "Resources" folder to make the SLR complete. Otherwise VS doesn't even see these files or compile. Right now kludging the files around until something works; I was just wondering if there was any sort of documentation or trick I'm not seeing.

Your MSI Template piece worked like a charm. That latest release I was able (obviously) to compile and package into an install worked fine too. I must not be seeing something with this source file.

Feb 2, 2012 at 11:21 PM

you need this video

How to install the source version of a module

http://www.dotnetnuke.com/Resources/Video-Library/Viewer/VideoId/242/Installing-The-Source-Version-Of-A-Module.aspx

 

Feb 3, 2012 at 12:49 AM

Works great! Thanks for the video.