September 28th, 2010
Some cases of requirement, I need to have text editor in Navision that does not limited to 1K of string and I need able to have break line and simple decoration. This large text could be for explanation of production description, shipping handling or document requirement or could be some comment. So I try to develop a new stuff in Nav 2009 sp1 features call control Addin an as usual using Visual Studio Express Edition 2010 to create one.
I have only simple objective which able to write text freely using RichTextBox .net control and store in into Blob field as expected. There are little troublesome I found that I could not use enter in the Richtextbox control under the RTC Page. It is not good to have rich text box without ability to create a break line certainly. So eventually I end up displaying button on the RTC page and when user click the button, it will pop up a modal window with Richtextbox. Here below the overall pictures.
To make this blog article short, I will directly to the important point in development while the detail and the source code project is attached in this article. So please try it and use it freely. The important points in this development as follow:
- Add reference to Microsoft.Dynamics.Framework.UI.Extensibility.dll which you can found it in RTC installed folder.
- Don’t forget to use class attribute ControlAddInExport to give a name for your control addin name when you call it from RTC page. I call it “NavEditorAddin”.
- My control add in class will inherit from WinFormsControlAddinBase and importantly also implement interface IValueControlAddInDefinition. This interface gives me the only possibility to have two ways of data binding which mean Display and Update back the changes to database.
- Create a strong name key file and sign the assembly in visual studio project property.
- Compile the project and copy the generated Dll into .. \RoleTailored Client\Add-ins folder where the RTC will need it.
- Make the dll register in global assembly. You can do drag and drop into assembly folder in C:\Windows\assembly or using command line GACUTIL –I <the assembly file>. Note GACUTIL is .net framework utility tools.
- Once successful registered, you can find the public key token in the assembly folder itself. Find your class assembly there and right columns on the side display a key.
- On the classic client, you need to register the control add in by entering a new line into a virtual table 2000000069 Client Add-in
In the page where you want to use the text editor you will need to change following property. Please note, I am using a BLOB field as my SourceExpr.
Here is the project source code and enjoy!