.net integration

User eda6f877b4

29-05-2009 07:20:20

Hi, could you clarify for me what I actually need to use jchem from within .net. More specifically do I, in the latest release, need the JNBridge??


I am running on jchem 5.2


Dann

ChemAxon 6e93227fcc

29-05-2009 07:39:29

Hi Dann,


Let me clarify this for you. Currently we have 2 solutions for .NET integration. One is using JNBridge and one is using IKVM. You can find some technical aspects about them on our website at http://chemaxon.com/NET_support_land.html


However we suggest you to use IKVM based solution because it has several advantages. If you will download and install our latest JChem .NET API from http://chemaxon.com/jchem/download.html (direct link http://www.chemaxon.com/download.php?d=/data/download/jchem/JChem__NET_API_5_2_02.msi) you will find some .NET examples with it.


Please tell me if you need anything else or if you have other questions.


Calin Naghi.

User eda6f877b4

29-05-2009 07:58:29

Hi Calin,


Thanks for your reply, I will try IKVM approach...


Dann

User eda6f877b4

29-05-2009 08:01:47

.. just a quick follow up.


I read in a privious post about the marvin applets and .net that this was not fully finished.


How is the best approach for the applets. Still to use the java applets??


(I am building a web application)


Dann

ChemAxon 6e93227fcc

29-05-2009 08:57:44

Probably you want to have molecule editor functionality in your website right?


For a web application you will have to use molecule applet based editor. You will find out on our website how to include it in your page.


However in order to save the molecule on server or if you want to generate the molecule image on server, based on what the user has edited in applet you will have to do some JavaScript interaction.


I assume you want to use it in a ASP.NET website. In this situation you will have to do something like this:


1. Put the marvin applet editor (MSketch) in your aspx page.


2. Probably you will have a ASP.NET button which makes a submit of the current page(form). For that button attach a client JavaScript function (OnClientClick="getMoleculeFromApplet();" )


3. The "getMoleculeFromApplet" javascript function will look like


function getMoleculeFromApplet()


{


    document.getElementById("some_input_type_hidden_element").value = escape(MSketch.getMol("mrv"));


}


Remarks:


MSketch is the name of the marvin applet object.


If you create an ASP.NET hidden field you might want to use instead of "some_input_type_hidden_element" something like "<%=yourHiddenField.ClientID%>" - this is because normally the generated client id for a ASP.NET control is not the same with server side id.


4. On server side you get the molecule string in mrv format from "yourHiddenField.Value". Don't forget that this string was escaped in JavaScript so you have to make a Server.UrlDecode.


5. Now you should have the molecule string on server side in mrv format. So if you want to generate the molecule image you just have to follow the examples provided with JChem .NET API.


Hope this will help you...


Calin Naghi.

User eda6f877b4

29-05-2009 08:59:54

Excellent! Thank you very much...


Dann