Today I came across a kind of weird error, which really should be handled by InfoPath Team.
I had created a InfoPath 2007 browser enabled form with just the following two controls:
- A checkbox.
- An Optional Section with few textboxes.
My intention was to show/hide the optional section based upon the check box selection.
So, when I select the checkbox, the section would show up and hide when unselected.
To implement such a simple logic, I had the below code fragment in VSTA from one of the Microsoft Labs:
//*******************************************************************************//
public void chkStatus_Changed(object sender, XmlEventArgs e)
{
// Write your code here to change the main data source.
if (e.NewValue.Equals("true")) //if selected
CurrentView.ExecuteAction(ActionType.XOptionalInsert, "group2_2");
else //if not selected
{
XPathNavigator node =
MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:group2",
NamespaceManager);
CurrentView.SelectNodes(node, node, "CTRL5");
CurrentView.ExecuteAction(ActionType.XOptionalRemove, "group2_2");
}
}
//*******************************************************************************//
But when compiled in VSTA, it throws the below error:
'Microsoft.Office.InfoPath.View' does not contain a definition for 'ExecuteAction'.
Found a relevant resolution at this location:
http://blogs.msdn.com/infopath/archive/2007/05/17/how-to-integrate-the-net-framework-sdk-documentation-with-vsta.aspx
But it talks about changing the Forms compatibility, which I donot need.
Instead, I must agree, that there is a multiple existence of the 'Microsoft.Office.InfoPath.dll', one of 47KB and other of 59KB.
So I got this resolved by removing the refrence of this (47KB) dll and adding it back again from the other location with 59KB.
Compile it again...and I have my browser enabled form back again, compiling successfully.
Suggestions for InfoPath Team:
- Keep a single copy of this DLL ('Microsoft.Office.InfoPath.dll').
- or Modify the reference to the Dll whenever the Compatibility checkbox is selected/unselected to point to the correct DLL.
Hope this is helpful to someone getting the same error.
3 comments:
Thanks so much.!! Your suggestion helped me solve the same error i faced...:)
Rahul,
I am glad that this helped you.
I always try to put my experiences or findings/tips from other people compiled at one location. This helps people like you and even as a reference point for me to help solve the various issues.
Thanks for stopping by my blog !
NeerajCh.
I don't know about enabling this DLL for browser-enabled forms. Seems risky (but tempting I must admit :)). This DLL it seems was meant for client-only forms, which is why it was made unavailable for your browser form in the first place.
Post a Comment