Managed Code - Taskpane

G

gareth

Yep,

This example (in C#) inserts data from the taskpane (a selected table
row) into the InfoPath document:

1) Create this function in your FormCode.cs file:

public void InsertLoanSchedule(double TotalMonthlyPay, double
TotalLoanAd)
{
//Add your code here to update xml nodes in xDocument
}

2) In your taskpane htm file add the following function (in the script
tag):

function InsertLoanData(objLoan)
{

window.external.Window.XDocument.Extension.InsertLoanSchedule(objLoan.TotalMonthlyPay,
objLoan.TotalLoanAd);
}

3) Call the function from your html item (eg table row) - a double
click event in this example:

<tr id="item6" TotalLoanAd="3500.00" TotalMonthlyPay="169.7"
AnnualRate="15" onDblClick="InsertLoanData(this)">
<td unselectable="on" width="109">3500.00</td>
<td unselectable="on" width="412">169.7</td>
</tr>

Voila!!
 
G

G. Tarazi

Another way, if you can't have the form fully trusted, create an event
handler on a node inside InfoPath (managed code), and change the value of
the node from the task pane (the script), that will trigger the managed code
in the event handler.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top