R
RJ
Have a form that works locally but when submitted to the form services, the
first 2 level of cascade works but not the 3rd, any ideas? It is using the
xml data list from sharepoint using the vti_bin/ossvr.dll and using some xml
data connections... i am stuck and don't know how to fix it, please
help..look at the code below.
/// <summary>
/// Resets the dropdownlists to their intial state
/// </summary>
private void InitializeDropDownLists()
{
DeleteList("ListOne");
LoadLevelOneList();
DeleteList("ListTwo");
DeleteList("ListThree");
}
/// <summary>
/// Loads lists for ListOne
/// </summary>
private void LoadLevelOneList()
{
LoadList("ListOne", string.Empty);
}
/// <summary>
/// Loads the lists for ListTwo
/// </summary>
/// <param name="parentTitle"></param>
private void LoadLevelTwoList(string parentTitle)
{
LoadList("ListTwo", parentTitle);
}
/// <summary>
/// Loads the lists for ListThree
/// </summary>
/// <param name="parentTitle"></param>
private void LoadLevelThreeList(string parentTitle)
{
LoadList("ListThree", parentTitle);
}
/// <summary>
/// Generic Load List Method used for all three lists
/// </summary>
/// <param name="dataSource"></param>
/// <param name="parentTitle"></param>
private void LoadList(string dataSource, string parentTitle)
{
XPathNavigator lists =
this.DataSources[dataSource].CreateNavigator();
DeleteList(ref lists);
DataRow[] rows = null;
if (dataSource.Equals("ListOne") )
rows = DataManager.Manager.GetLevelOneList();
else if(dataSource.Equals("ListTwo"))
rows = DataManager.Manager.GetLevelTwoList(parentTitle);
else if(dataSource.Equals("ListThree") )
rows = DataManager.Manager.GetLevelThreeList(parentTitle);
if(rows != null)
{
string title = String.Empty;
foreach (DataRow row in rows)
{
title = row["Title"].ToString();
XmlWriter xw = lists.AppendChild();
xw.WriteStartElement("List");
xw.WriteAttributeString("Title", title);
xw.WriteEndElement();
xw.Close();
}
}
}
/// <summary>
/// Method to delete all existing List Elements in an XPathNavigator
/// Used to empty dropdownlists prior to loading with fresh selections
/// </summary>
/// <param name="lists"></param>
private void DeleteList(ref XPathNavigator lists)
{
XPathNodeIterator xni = lists.Select("//List");
lists.MoveToChild("Lists", "");
while (lists.MoveToChild("List", ""))
{
lists.DeleteSelf();
}
xni = lists.Select("//List");
}
private void DeleteList(string dataSource)
{
XPathNavigator lists =
this.DataSources[dataSource].CreateNavigator();
XPathNodeIterator xni = lists.Select("//List");
DeleteList(ref lists);
xni = lists.Select("//List");
}
first 2 level of cascade works but not the 3rd, any ideas? It is using the
xml data list from sharepoint using the vti_bin/ossvr.dll and using some xml
data connections... i am stuck and don't know how to fix it, please
help..look at the code below.
/// <summary>
/// Resets the dropdownlists to their intial state
/// </summary>
private void InitializeDropDownLists()
{
DeleteList("ListOne");
LoadLevelOneList();
DeleteList("ListTwo");
DeleteList("ListThree");
}
/// <summary>
/// Loads lists for ListOne
/// </summary>
private void LoadLevelOneList()
{
LoadList("ListOne", string.Empty);
}
/// <summary>
/// Loads the lists for ListTwo
/// </summary>
/// <param name="parentTitle"></param>
private void LoadLevelTwoList(string parentTitle)
{
LoadList("ListTwo", parentTitle);
}
/// <summary>
/// Loads the lists for ListThree
/// </summary>
/// <param name="parentTitle"></param>
private void LoadLevelThreeList(string parentTitle)
{
LoadList("ListThree", parentTitle);
}
/// <summary>
/// Generic Load List Method used for all three lists
/// </summary>
/// <param name="dataSource"></param>
/// <param name="parentTitle"></param>
private void LoadList(string dataSource, string parentTitle)
{
XPathNavigator lists =
this.DataSources[dataSource].CreateNavigator();
DeleteList(ref lists);
DataRow[] rows = null;
if (dataSource.Equals("ListOne") )
rows = DataManager.Manager.GetLevelOneList();
else if(dataSource.Equals("ListTwo"))
rows = DataManager.Manager.GetLevelTwoList(parentTitle);
else if(dataSource.Equals("ListThree") )
rows = DataManager.Manager.GetLevelThreeList(parentTitle);
if(rows != null)
{
string title = String.Empty;
foreach (DataRow row in rows)
{
title = row["Title"].ToString();
XmlWriter xw = lists.AppendChild();
xw.WriteStartElement("List");
xw.WriteAttributeString("Title", title);
xw.WriteEndElement();
xw.Close();
}
}
}
/// <summary>
/// Method to delete all existing List Elements in an XPathNavigator
/// Used to empty dropdownlists prior to loading with fresh selections
/// </summary>
/// <param name="lists"></param>
private void DeleteList(ref XPathNavigator lists)
{
XPathNodeIterator xni = lists.Select("//List");
lists.MoveToChild("Lists", "");
while (lists.MoveToChild("List", ""))
{
lists.DeleteSelf();
}
xni = lists.Select("//List");
}
private void DeleteList(string dataSource)
{
XPathNavigator lists =
this.DataSources[dataSource].CreateNavigator();
XPathNodeIterator xni = lists.Select("//List");
DeleteList(ref lists);
xni = lists.Select("//List");
}