TIA for any and all consideration and positive comments.
I'm trying to copy elements from a datasource into a repeating table. I've found success all except for populating blank dates. I've scoured the forum and found a few comments about the xsi:nil tag, but (from what I could decipher) those were geared towards javascript and creating tables on the fly.
Here's my code thus far:
[snip]
XPathNavigator referencedNav = this.DataSources["referenceDS"].CreateNavigator();
XPathNavigator rootNav = this.MainDataSource.CreateNavigator();
string selectedItemsXPath = "/my:myFields/my:grpItemsSelected";
foreach (XPathNavigator people in referencedNav.Select(otherSelectedItemsXpath, NamespaceManager))
{
if (people.SelectSingleNode("Selected", NamespaceManager).Value.ToLower() == "yes")
{
string myNamespace = NamespaceManager.LookupNamespace("my");
using (XmlWriter writer = MainDataSource.CreateNavigator().SelectSingleNode(selectedItemsXPath, NamespaceManager).AppendChild())
{
writer.WriteStartElement("selectedItems", myNamespace);
writer.WriteElementString("Selected", myNamespace, "no");
writer.WriteElementString("priKey", myNamespace, people.SelectSingleNode("priKey", NamespaceManager).Value.ToLower());
writer.WriteElementString("FirstName", myNamespace, people.SelectSingleNode("FirstName", NamespaceManager).Value.ToLower());
writer.WriteElementString("LastName", myNamespace, people.SelectSingleNode("LastName", NamespaceManager).Value.ToLower());
writer.WriteElementString("startdate", myNamespace, "");
writer.WriteElementString("enddate", myNamespace, "");
writer.WriteEndElement();
writer.Close();
}
}
}
[/snip]
My problem then becomes that IP doesn't accept blank dates and gives the dreaded "some rules were not applied" error upon submit. Has anyone tackled this problem using C# and the writeelementstring approach I've outlined above?
Thanks again.