Hi, I'm trying to create a control add-in for use in the NAV 2013 r2 web client written in C#.
However I'm stuck on how the winform can get displayed in the web client using javascript or if it's possible at all?
Currently I have embedded the winform project as a html object in my javascript manifest. This winform project has been registered as a class library dll with some [comvisible] methods. This works ok when I call a simple helloworld() method within this project that returns a string but I'm unsure how to call my main createcontrol() function that returns a form.
Does anyone have an example of a similar C# winform project for use in web client or can guide me in the right direction? Any help would be greatly appreciated.
Cheers.
Here's the manifest file;
<?xml version="1.0" encoding="utf-8"?>
<Manifest>
<ScriptUrls>
<ScriptUrl>
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js</ScriptUrl>
</ScriptUrls>
<Script>
<![CDATA[
var LeaveCalendarObject = null;
var returntext = null;
function InitializeControl(controlId)
{
var leavecalendar = '<OBJECT id="DemoActiveX" classid="CLSID:A3C7EA29-CF01-47A1-B53A-F4623E0CC1F8" VIEWASTEXT></OBJECT>';
$("#" + controlId).append(leavecalendar);
LeaveCalendarObject = document.getElementById("DemoActiveX");
}
function SayHello() {
alert(LeaveCalendarObject.SayHello()); //This simple helloworld function works ok
LeaveCalendarObject.CreateControl() //this doesn't work
}
$(document).ready(function()
{
InitializeControl("controlAddIn");
Microsoft.Dynamics.NAV.InvokeExtensibilityMethod("ControlAddInReady");
});
]]>
</Script>
<RequestedHeight>360</RequestedHeight>
<RequestedWidth>640</RequestedWidth>
<VerticalStretch>true</VerticalStretch>
<HorizontalStretch>true</HorizontalStretch>
</Manifest>
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
For an introduction to the extensibility frameword for JavaScript-based control add-ins see this walkthrough document:
http://msdn.microsoft.com/en-us/library/dn182584(v=nav.71).aspx
Also consider watching this recording, which contains an introduction to the extensibility framework 26 minutes into the recording:
http://channel9.msdn.com/Events/Microsoft-Campus-Days/Microsoft-Campus-Days-2013/Web-client-2-0-for-NAV-2013R2_V2
Thomas Søndergaard Jensen [MSFT]
This posting is provided 'AS IS' with no warranties, and confers no rights.