Code for cascade works locally not form services...

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");
}
 
B

Ben Walters

Hey RJ,
I put this on your other post as well but check out this link below
hopefully it will help

http://msmvps.com/blogs/benwalters/archive/2007/08/05/filtered-drop-down-lists-101.aspx

If not let me know and I'll put up some more details

Cheers
Ben Walters

RJ said:
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");
}
 
R

RJ

thank you for your reply, sorry took so long to respond. I have taken a look
at your Filtered Drop Down Lists 101 Part 2 article, now I am not advanced in
programming yet so its a little foreign to me, I do not want it in repeating
table, as it needs to be in 3 separate drop down list, does anything in the
code reference to the repeating drop down or it doesn't make a difference?
This seems simple enough for me to recreate. Thank you again for your time.

Ben Walters said:
Hey RJ,
I put this on your other post as well but check out this link below
hopefully it will help

http://msmvps.com/blogs/benwalters/archive/2007/08/05/filtered-drop-down-lists-101.aspx

If not let me know and I'll put up some more details

Cheers
Ben Walters

RJ said:
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");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top