Skip to main content


Showing posts with the label Get Parameters in InfoPath Form

Infopath Code

Here are some important codes for InfoPath. 
Get Parameters in InfoPath Form:
if (e.InputParameters.ContainsKey("SaveLocation")) // Search for Query string (parameter) if found then set this parameter to a field.                     SetFormFieldValue ("/my:ChangeOrder/my:SectionHide/my:ListURL", e.InputParameters["SaveLocation"].Substring(0, e.InputParameters["SaveLocation"].LastIndexOf("/")));

Get Value from a field:
privatestring GetFormFieldValue(string fieldName)         { string fieldValue = string.Empty; try             { XPathNavigator myNav = MainDataSource.CreateNavigator().SelectSingleNode(fieldName, NamespaceManager); if (myNav != null)                     fieldValue = myNav.Value; ;
if (string.IsNullOrEmpty(fieldValue)) returnstring.Empty; else return fieldValue;             } catch { return fieldValue; }         }
Set Value for a field:
privatevoid SetFormFieldValue(string fieldName, string fieldValue)         { XPathNavigator myNav = MainDataSo…