E
erugalatha
Hello,
I have a form with 4 dropdowns on it. I want the first 3 to filter the 4th
when items are selected in them. I am looking up to a SharePoint List and I
can get the List Items to come back into an SPListItemCollection.
I'm stuck on getting the SPListItemCollection ListItems to populate into my
Dropdown list box. I can see my list items are populated into the questions
SPListItemCollection from my function called PopulateQuestions. On the first
step through of the code it works but when it steps into the second ListItem
in questions I get the following error in debug:
NOTE: the dropdown is a string datatype.
System.InvalidOperationException was caught
Message="Schema validation found non-data type errors."
Source="Microsoft.Office.InfoPath.Client.Internal.Host.Interop"
StackTrace:
at
Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlDocument.ThrowExceptionFromMsxmlInteropError(MsxmlInteropError eError)
at
Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlDocument.ThrowExceptionFromHresult(Int32 hrError)
at
Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlNodeImpl.InsertBefore(String
strXml, MsxmlNode refChild)
at Microsoft.Office.InfoPath.MsxmlWriter.Close()
at System.Xml.XmlWellFormedWriter.Close()
at System.Xml.XPath.XPathNavigator.InsertAfter(XmlReader newSibling)
at System.Xml.XPath.XPathNavigator.InsertAfter(XPathNavigator
newSibling)
at GlanbiaGIIAuditForm.FormCode.InternalStartup() in
C:\Projects\Form\Form\FormCode.cs:line 71
Here is my code:
try
{
//CALL THE FUNCTION TO POPULATE THE QUESTIONS DROPDOWN
SPListItemCollection questions =
PopulateQuestions(nodeLocation.Value.ToString(), nodeArea.Value.ToString(),
nodeType.Value.ToString());
//SET UP NODE TO ALLOW CLONE OF THE nodeQuestions NODE
XPathNavigator nodeQClone = null;
//FILL THE QUESTIONS DROPDOWN WITH THE DATA RETURNED
if (questions != null)
{
foreach (SPListItem ListItem in questions)
{
nodeQClone = nodeQuestionList.Clone();
nodeQClone.SelectSingleNode("/my:thing/my:questions/my:question",
this.NamespaceManager).SetValue(Convert.ToString(ListItem["Title"]));
nodeQuestionList.InsertAfter(nodeQClone);
if (questions.Count > 0)
//DELETE THE PARENT NODE TO REMOVE DUPLICATE ENTRY
nodeQuestionList.DeleteSelf();
}
}
}
Do you know where I'm going wrong?
I have a form with 4 dropdowns on it. I want the first 3 to filter the 4th
when items are selected in them. I am looking up to a SharePoint List and I
can get the List Items to come back into an SPListItemCollection.
I'm stuck on getting the SPListItemCollection ListItems to populate into my
Dropdown list box. I can see my list items are populated into the questions
SPListItemCollection from my function called PopulateQuestions. On the first
step through of the code it works but when it steps into the second ListItem
in questions I get the following error in debug:
NOTE: the dropdown is a string datatype.
System.InvalidOperationException was caught
Message="Schema validation found non-data type errors."
Source="Microsoft.Office.InfoPath.Client.Internal.Host.Interop"
StackTrace:
at
Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlDocument.ThrowExceptionFromMsxmlInteropError(MsxmlInteropError eError)
at
Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlDocument.ThrowExceptionFromHresult(Int32 hrError)
at
Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlNodeImpl.InsertBefore(String
strXml, MsxmlNode refChild)
at Microsoft.Office.InfoPath.MsxmlWriter.Close()
at System.Xml.XmlWellFormedWriter.Close()
at System.Xml.XPath.XPathNavigator.InsertAfter(XmlReader newSibling)
at System.Xml.XPath.XPathNavigator.InsertAfter(XPathNavigator
newSibling)
at GlanbiaGIIAuditForm.FormCode.InternalStartup() in
C:\Projects\Form\Form\FormCode.cs:line 71
Here is my code:
try
{
//CALL THE FUNCTION TO POPULATE THE QUESTIONS DROPDOWN
SPListItemCollection questions =
PopulateQuestions(nodeLocation.Value.ToString(), nodeArea.Value.ToString(),
nodeType.Value.ToString());
//SET UP NODE TO ALLOW CLONE OF THE nodeQuestions NODE
XPathNavigator nodeQClone = null;
//FILL THE QUESTIONS DROPDOWN WITH THE DATA RETURNED
if (questions != null)
{
foreach (SPListItem ListItem in questions)
{
nodeQClone = nodeQuestionList.Clone();
nodeQClone.SelectSingleNode("/my:thing/my:questions/my:question",
this.NamespaceManager).SetValue(Convert.ToString(ListItem["Title"]));
nodeQuestionList.InsertAfter(nodeQClone);
if (questions.Count > 0)
//DELETE THE PARENT NODE TO REMOVE DUPLICATE ENTRY
nodeQuestionList.DeleteSelf();
}
}
}
Do you know where I'm going wrong?