Task Pane - Managed Code - InfoPath Dev
in

InfoPath Dev

Task Pane - Managed Code

Last post 11-17-2006 09:45 AM by Greg Collins. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 11-14-2006 08:39 AM

    Task Pane - Managed Code

    Im looking to display <div elements in a custom task pane, dependent on what is selected in the infopath form.

    If i were to do this via unmanaged code it would be similar to this on the ContextChange event:

    var oTaskPane = XDocument.View.Window.TaskPanes.Item(0);

    //Retrieve html object for task pane
    var oHTMLDoc = oTaskPane.HTMLDocument.all;

    //Clear previous help topic from task pane
    if (helpString)
    oHTMLDoc.item(helpString).style.display = "none";

    //Display DIV Statemment having same ID as the context node name
    oHTMLDoc.item(eventObj.Context.nodeName).style.display = "";

    //Keep records of string displayed so can be cleared later
    helpString = eventObj.Context.nodeName;

    How do achive the same in managed code?

    Thanks in advance
  • 11-15-2006 09:33 AM In reply to

    Re: Task Pane - Managed Code

    You can call into the task pane from managed code, but it will require Full Trust on your form because you are calling from managed to unmanaged code. If you go in the reverse (unmanaged to managed -or- task pane to form) then the Full Trust requirement does not exist.
  • 11-16-2006 12:49 AM In reply to

    Re: Task Pane - Managed Code

    quote:
    If you go in the reverse (unmanaged to managed -or- task pane to form) then the Full Trust requirement does not exist.


    How would i do this. Have you any examples?
  • 11-16-2006 09:16 AM In reply to

    Re: Task Pane - Managed Code

    From the task pane you access: window.external.Window.XDocument

    Once you've got this handle to the XDocument, you can work it just like you would inside your form's code.

    Keep in mind that you might not be able to do everything you want going from the task pane to the form code. If you can, then this will save you needing to go Full Trust.
  • 11-17-2006 02:45 AM In reply to

    Re: Task Pane - Managed Code

    Is there any way i can call a method in the manged code from the task pane? for instance a validate before save method?

    Cheers
  • 11-17-2006 09:45 AM In reply to

    Re: Task Pane - Managed Code

    Certainly. XDocument contains an Extension property which gives access to your methods.

    var xd = window.external.XDocument;
    xd.Extension.MyMethod(param1, param2);
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.