Group:  Other Microsoft Office Products ยป microsoft.public.infopath
Thread: Code for cascade works locally not form services...

Geek News

Code for cascade works locally not form services...
RJ 11/6/2008 8:13:01 PM
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");
}
Re: Code for cascade works locally not form services...
"Ben Walters" <ben.walters[ at ]gmail.com> 11/23/2008 11:30:50 AM
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" <RJ[ at ]discussions.microsoft.com> wrote in message
news:9B7DE9FE-C24A-4E64-BB3A-A4338D632C89[ at ]microsoft.com...
[Quoted Text]
> 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");
> }

Re: Code for cascade works locally not form services...
RJ 12/30/2008 4:14:00 PM
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" wrote:

[Quoted Text]
> 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" <RJ[ at ]discussions.microsoft.com> wrote in message
> news:9B7DE9FE-C24A-4E64-BB3A-A4338D632C89[ at ]microsoft.com...
> > 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");
> > }
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net