Why editing dynamic controls fails...

by dan 23. November 2009 12:55

Today my AxConsultant colleague Sascha Poth called me to complain about a nasty AxCMS.net 9.0 behavoir: It is fairly impossible to edit an AxCMS.net ElementTemplate. Minutes later, my fellow colleague Tim Kühl called my to complain about exactly the same thing...

I did a little research for myself to look if they were right:

As soon as I pressed the edit key in the frontend:

 


the following error message appeared:

 

ok... what could it be?

Looking at the exception.txt the following hint was given:

 System.InvalidCastException: Das Objekt des Typs "System.DBNull" kann nicht in Typ "System.String" umgewandelt werden.
   bei Axinom.AECMS.WebControls.AxStructureElement.LoadProperties(DataRow row)
   bei Axinom.AECMS.WebControls.AxStructureElement.LoadDB()
   bei Axinom.AECMS.WebControls.AxControlUtility.LoadAxControl(IClassifiable element)
   bei AxCMS.AxCMSweb.Concept.b(IClassifiable A_0)

So I set up a little unit test to check if everything is alright. The outcome:

Following code is totally ok:

            AxStructureElement element = new AxStructureElement();
            element.AxID = 13;
            element.LoadDB();

This code reflects the first two rows in the error messages by manually loading the AxStructureElement in carge.

Adding these three lines reproduces the error shown above:

            AxStructureElement element = new AxStructureElement();
            element.AxID = 13;
            element.LoadDB();

            IAxControl control = (IAxControl)AxControlUtility.CreateElement((ElementTypes)element.Type);
            control.AxID = (int)((IClassifiable)element).ID;
            control.LoadDB();

Where is the trick in it? The AxControlUtility.LoadAxControl(element) function uses exactly the three lines added above. When you did deep enough into the AxStructureElement class you will see that the IClassifiable interface is implemented at least incomplete: It does not return the elements AxID as it is supposed to do but it return the elements TemplateID

Edit:

Axinom quickly responded and provides their partners with a patched .dll file. Please contact your local partner support manager if you need to get it!

Best,
Dan


Checking your AxCMS.net 9.0 License Files

by dan 14. September 2009 20:38

As mentioned before the AxCMS.net 9.0 introduces a new license model. From now on you really need a license for every website or you will be bugged with annoying license failure notifications.

Having lots of pages this will lead to lots of licenses and the question is how to kepp track of them. The answer is quite easy indeed: Just drag your license file onto Visual Studio and it will reveal itsself like a charm.

The license is valid for usage by the company of EDV-Partner on their Website http://www.edvpartner.de. The license was requested by myself in charge of EDV-Partner. Trying to use this license out of the edvpartner.de environment will lead to an error message.
 
This message will also be visible when developing in a local environment. So in the future you will need two licences: A localhost enabled license for local development and a productive license for the live environment. 
 
Best Regards
Dan 

Dan Wucherpfennig - AxCMS.net evangelist

Dan Wucherpfennig is an IT consultant employed at EDV-Partner (http://www.edvpartner.de), a Hamburg based system integration and consulting company. 

Having many years of experience in developing projects with AxCMS.net, Dan has been awarded as an AxConsultant during the AxDays 2008.

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar