Web Client Control Add-Ins

eamonnoceamonnoc Member Posts: 3
edited 2014-05-07 in NAV Three Tier
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&gt;
</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

  • kinekine Member Posts: 12,562
    I was looking for that too. The adding in NAV 2013 R2 his totally different thing than before. You need to look for JScript things, the output of the addin must be HTML which is included than in the client. I think that you cannot use the winform controls for that. Rather some HTML5 controls or something like that. But as I wrote, I am on same level like you in this... 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Thomas_JensenThomas_Jensen Member, Microsoft Employee Posts: 7
    It is correct that you cannot use WinForms controls in a Web Client control add-in. For these add-ins you need to use HTML and JavaScript.

    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
    Best regards,
    Thomas Søndergaard Jensen [MSFT]

    This posting is provided 'AS IS' with no warranties, and confers no rights.
Sign In or Register to comment.