Home Search Member List Faq Register Login  
UltimateSitemap
Re: Trying to bind data from SQL table

Thread Starter: goodfella   Started: 10-29-2007 2:35 PM   Replies: 14
 Karamasoft Support Forums » General Discussions » UltimateSitemap » Re: Trying to bind data from SQL table
 Printable Version    « Previous Thread   Next Thread »
  29 Oct 2007, 2:35 PM
goodfella is not online. Last active: 9/25/2008 1:32:00 AM goodfella

Top 10 Posts
Joined on 04-25-2007
Posts 42
Trying to bind data from SQL table
Hello,

I am trying to bind data from an array, created from a set of data in a Pages table in my SQL database. I am receiving the error "Sitemap source XML cannot be loaded."

Here is my code:

DSDataLayer.PagesDB pDB = new DSDataLayer.PagesDB();
DSDataLayer.BasePageData[] pgAll = pDB.Page_GetAllWithParentIDIgnoreStatus(-1);

DataSet ds = new DataSet();
ds.Tables.Add();
ds.Tables[0].Columns.Add("Column1");

foreach (object ob in pgAll)
{
ds.Tables[0].Rows.Add(new object[] { ob });
}

UltimateSitemap1.DataSource = ds;
UltimateSitemap1.DataBind();

  
  29 Oct 2007, 2:47 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: Trying to bind data from SQL table
You cannot set the DataSource property to any dataset. Your dataset must be in the form of C:\Inetpub\wwwroot\Karamasoft\UltimateSitemap\v2.1\Demos\CS\Samples\Sitemap\Feature\DataBinding\DataBinding.xml. Please also take a look at the table structures and samples shown under C:\Inetpub\wwwroot\Karamasoft\UltimateSitemap\v2.1\Controls\Documents\DataBinding.
  
  02 Nov 2007, 12:40 AM
goodfella is not online. Last active: 9/25/2008 1:32:00 AM goodfella

Top 10 Posts
Joined on 04-25-2007
Posts 42
Re: Trying to bind data from SQL table
Thanks for that. However, I am trying to take an array of data (created from a table in a database which houses all of our pages), and convert this to a dataset for the purpose of use in the UltimateSiteMap. I am writing this to an XML file for debugging purposes, and it appears to look the same as if i were pulling this info from a UltimateSiteMap table. Here is my code. Any help would be greatly appreciated. Am I misunderstanding something? Thanks!

ASPX
<cc1:UltimateSitemap ID="UltimateSitemap1" runat="server" Bitmap="UltimateSitemap.bmp"
StartingDepth="1" ColumnCount="3" TableCellCssClass="SiteMap" TableCellWidth="200" TableCellHeight="200" />

C#
AppDataLayer.PagesDB rDB = new AppDataLayer.PagesDB();
AppDataLayer.BasicPageData[] rgAll = rDB.Page_GetAll();

DataSet ds = new DataSet("UltimateSiteMap");
DataTable dt = new DataTable();

DataColumn[] keys = new DataColumn[2];

DataColumn sitemapID = new DataColumn();
sitemapID.DataType = System.Type.GetType("System.String");
sitemapID.ColumnName = "sitemapID";
dt.Columns.Add(sitemapID);
keys[0] = sitemapID;

DataColumn nodeID = new DataColumn();
nodeID.DataType = System.Type.GetType("System.Int32");
nodeID.ColumnName = "nodeID";
//nodeID.Data
dt.Columns.Add(nodeID);
keys[1] = nodeID;

DataColumn parentNodeID = new DataColumn();
parentNodeID.DataType = System.Type.GetType("System.Int32");
parentNodeID.ColumnName = "parentNodeID";
dt.Columns.Add(parentNodeID);

DataColumn sortOrder = new DataColumn();
sortOrder.DataType = System.Type.GetType("System.Int32");
sortOrder.ColumnName = "sortOrder";
dt.Columns.Add(sortOrder);

DataColumn title = new DataColumn();
title.DataType = System.Type.GetType("System.String");
title.ColumnName = "title";
dt.Columns.Add(title);

DataColumn url = new DataColumn();
url.DataType = System.Type.GetType("System.String");
url.ColumnName = "url";
dt.Columns.Add(url);

DataColumn description = new DataColumn();
description.DataType = System.Type.GetType("System.String");
description.ColumnName = "description";
dt.Columns.Add(description);

DataColumn nodeCssClass = new DataColumn();
nodeCssClass.DataType = System.Type.GetType("System.String");
nodeCssClass.ColumnName = "nodeCssClass";
dt.Columns.Add(nodeCssClass);

DataColumn childNodeCssClass = new DataColumn();
childNodeCssClass.DataType = System.Type.GetType("System.String");
childNodeCssClass.ColumnName = "childNodeCssClass";
dt.Columns.Add(childNodeCssClass);

DataColumn nodePrefix = new DataColumn();
nodePrefix.DataType = System.Type.GetType("System.String");
nodePrefix.ColumnName = "nodePrefix";
dt.Columns.Add(nodePrefix);

DataColumn nodeSuffix = new DataColumn();
nodeSuffix.DataType = System.Type.GetType("System.String");
nodeSuffix.ColumnName = "nodeSuffix";
dt.Columns.Add(nodeSuffix);

DataColumn childNodePrefix = new DataColumn();
childNodePrefix.DataType = System.Type.GetType("System.String");
childNodePrefix.ColumnName = "childNodePrefix";
dt.Columns.Add(childNodePrefix);

DataColumn childNodeSuffix = new DataColumn();
childNodeSuffix.DataType = System.Type.GetType("System.String");
childNodeSuffix.ColumnName = "childNodeSuffix";
dt.Columns.Add(childNodeSuffix);

DataColumn folderClosedImage = new DataColumn();
folderClosedImage.DataType = System.Type.GetType("System.String");
folderClosedImage.ColumnName = "folderClosedImage";
dt.Columns.Add(folderClosedImage);

DataColumn folderOpenImage = new DataColumn();
folderOpenImage.DataType = System.Type.GetType("System.String");
folderOpenImage.ColumnName = "folderOpenImage";
dt.Columns.Add(folderOpenImage);

DataColumn columnIndex = new DataColumn();
columnIndex.DataType = System.Type.GetType("System.String");
columnIndex.ColumnName = "columnIndex";
dt.Columns.Add(columnIndex);

DataColumn rowIndex = new DataColumn();
rowIndex.DataType = System.Type.GetType("System.String");
rowIndex.ColumnName = "rowIndex";
dt.Columns.Add(rowIndex);

ds.Tables.Add(dt);
dt.TableName = "Table";

int iCount = rgAll.Length;
dt.PrimaryKey = keys;

for (int i = 0; i < iCount; i++)
{
DataRow dr = dt.NewRow();
dr["sitemapID"] = "SiteMap1";
dr["nodeID"] = rgAllIdea.ID;
dr["parentNodeID"] = rgAllIdea.ParentPageID;
dr["sortOrder"] = rgAllIdea.Position;
dr["title"] = rgAllIdea.PageName;
dr["description"] = "";
dr["url"] = "~/content/default.aspx?pud=" + rgAllIdea.GUID;
dr["nodeCssClass"] = "";
dr["childNodeCssClass"] = "";
dr["nodePrefix"] = "";
dr["nodeSuffix"] = "";
dr["childNodePrefix"] = "";
dr["childNodeSuffix"] = "";
dr["folderClosedImage"] = "";
dr["folderOpenImage"] = "";
dr["columnIndex"] = "";
dr["rowIndex"] = "";

dt.Rows.Add(dr);
}

// For Debugging Purposes Only
ds.WriteXml("test.xml");
ds.WriteXmlSchema("test2.xml");

UltimateSitemap1.DataSource = ds;
UltimateSitemap1.DataBind();

Sample Test.XML output (actual files has 92 rows)
<?xml version="1.0" standalone="yes"?>
<UltimateSiteMap>
<Table>
<sitemapID>SiteMap1</sitemapID>
<nodeID>1</nodeID>
<parentNodeID>-1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Home</title>
<url>~/content/default.aspx?pud=aghjag87aghj879agagagag</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</Table>
<Table>
<sitemapID>SiteMap1</sitemapID>
<nodeID>2</nodeID>
<parentNodeID>-1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Page B</title>
<url>~/content/default.aspx?pud=135ag8tj87aghhj7uahjag</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</Table>
<Table>
<sitemapID>SiteMap1</sitemapID>
<nodeID>3</nodeID>
<parentNodeID>-1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Page C</title>
<url>~/content/default.aspx?pud=agjh76ahg897aghkjagag</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</Table>

  
  02 Nov 2007, 12:41 AM
goodfella is not online. Last active: 9/25/2008 1:32:00 AM goodfella

Top 10 Posts
Joined on 04-25-2007
Posts 42
Re: Trying to bind data from SQL table
The little light bulbs are the array i.. should be [ i ] .. thanks!
  
  02 Nov 2007, 2:03 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: Trying to bind data from SQL table

Please change the following two lines in your code:

DataSet ds = new DataSet("UltimateSiteMap");
...
dt.TableName = "Table";


as follows:

DataSet ds = new DataSet("DataBinding");
...
dt.TableName = "UltimateSiteMap";


You may compare your test.xml file with C:\Inetpub\wwwroot\Karamasoft\UltimateSitemap\v2.1\Controls\Documents\DataBinding\UltimateSitemap.xml.


  
  02 Nov 2007, 2:51 PM
goodfella is not online. Last active: 9/25/2008 1:32:00 AM goodfella

Top 10 Posts
Joined on 04-25-2007
Posts 42
Re: Trying to bind data from SQL table
Thanks. That's got me closer. I now no longer receive the error to the effect of "can not load XML data", but i just get... nothing.

The XML file now looks much closer. Of course, there are subtle differences but the dataset should be the same.

<DataBinding>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>1</nodeID>
<parentNodeID>-1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Home</title>
<url>~/content/default.aspx?pud=3d0aa760-a5a0-4ba9-bead-04basgad5e766</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>

vs.

<DataBinding>
<UltimateSitemap sitemapID="Sitemap2" nodeID="Node2" parentNodeID="Node1" sortOrder="1" title="Products, Solutions and Services" url="~/Samples/Sitemap/Feature/DataBinding/DataBinding.aspx?NodeID=Node2" />

The XML file header is slightly different, but this shouldnt affect the dataset


<?xml version="1.0" standalone="yes"?> vs. <?xml version="1.0" encoding="utf-8"?>


  
  02 Nov 2007, 2:55 PM
goodfella is not online. Last active: 9/25/2008 1:32:00 AM goodfella

Top 10 Posts
Joined on 04-25-2007
Posts 42
Re: Trying to bind data from SQL table
Just to confirm, I have also set the sitemapID as follows

UltimateSitemap1.DatabaseSitemapID = "SiteMap1";



  
  02 Nov 2007, 2:58 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: Trying to bind data from SQL table
Use parentNodeID="SitemapRoot" instead of parentNodeID="-1" for your top-level nodes.
  
  02 Nov 2007, 3:12 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: Trying to bind data from SQL table
You shouldn't call:
 
UltimateSitemap1.DatabaseSitemapID = "SiteMap1";

because you're not using the provided database tables, but your own in this case. So all you need is your existing code snippet to build your dataset programmatically, and then call:

UltimateSitemap1.DataSource = ds;

You can also take a look at the DataBinding sample at C:\Inetpub\wwwroot\Karamasoft\UltimateSitemap\v2.1\Demos\CS\Samples\Sitemap\Feature\DataBinding.

  
  02 Nov 2007, 4:09 PM
goodfella is not online. Last active: 9/25/2008 1:32:00 AM goodfella

Top 10 Posts
Joined on 04-25-2007
Posts 42
Re: Trying to bind data from SQL table
Thank you. I made the following changes:

for (int i = 0; i < iCount; i++)
{
DataRow dr = dt.NewRow();
dr["sitemapID"] = "SiteMap1";
dr["nodeID"] = rgAllIdea.ID.ToString();
if (rgAllIdea.ID == 1)
{
dr["parentNodeID"] = "SitemapRoot";
}
else
{
//if (rgAllIdea.ParentPageID == -1)
//{
// dr["parentNodeID"] = "SitemapRoot";
//}
//else
//{
dr["parentNodeID"] = rgAllIdea.ParentPageID.ToString();
//}
}
dr["sortOrder"] = rgAllIdea.Position.ToString();
dr["title"] = rgAllIdea.PageName;
dr["description"] = "";
dr["url"] = "~/content/default.aspx?pud=" + rgAllIdea.GUID;
dr["nodeCssClass"] = "";
dr["childNodeCssClass"] = "";
dr["nodePrefix"] = "";
dr["nodeSuffix"] = "";
dr["childNodePrefix"] = "";
dr["childNodeSuffix"] = "";
dr["folderClosedImage"] = "";
dr["folderOpenImage"] = "";
dr["columnIndex"] = "";
dr["rowIndex"] = "";

dt.Rows.Add(dr);
}

ds.WriteXml("test.xml");

UltimateSitemap1.DataSource = ds;

The sitemap loads only the first node, "Home" and doesn't load anything else. The XML file looks like this now (posting the first several.. if you need the whole file, let me know)

<?xml version="1.0" standalone="yes"?>
<DataBinding>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>1</nodeID>
<parentNodeID>SitemapRoot</parentNodeID>
<sortOrder>0</sortOrder>
<title>Home</title>
<url>~/content/default.aspx?pud=3d0dd760-a5a0-4ba9-bead-04b298d5e766</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>2</nodeID>
<parentNodeID>-1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Identify</title>
<url>~/content/default.aspx?pud=8f88c4c9-ab3d-433b-8d09-74e8c11953ae</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>3</nodeID>
<parentNodeID>-1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Prevent</title>
<url>~/content/default.aspx?pud=9f870131-7eac-45ad-8f8e-9f5c2a4c08b8</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>4</nodeID>
<parentNodeID>-1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Help</title>
<url>~/content/default.aspx?pud=65d9f270-ae9d-4dcd-8b92-590b2d49ad7b</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>5</nodeID>
<parentNodeID>-1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Hot Topics</title>
<url>~/content/default.aspx?pud=5a37988c-a923-43cd-b105-95876da13fe0</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>6</nodeID>
<parentNodeID>-1</parentNodeID>
<sortOrder>0</sortOrder>
<title>People of DEA</title>
<url>~/content/default.aspx?pud=efb6a828-f384-4670-b638-10cbf5c2862b</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>7</nodeID>
<parentNodeID>-1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Contact Us</title>
<url>~/content/default.aspx?pud=735a4661-fd27-4add-8a67-61e417028271</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>99</nodeID>
<parentNodeID>-1</parentNodeID>
<sortOrder>1</sortOrder>
<title>Privacy Policy</title>
<url>~/content/default.aspx?pud=b493ecbb-80bf-4bc8-9f7f-7ccd6f521719</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>9</nodeID>
<parentNodeID>2</parentNodeID>
<sortOrder>2</sortOrder>
<title>Visual Glossary</title>
<url>~/content/default.aspx?pud=0001a04a-0466-49b9-b12c-4109909ee946</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>

As you can see from my code, I tried setting the parentNodeID to "SitemapRoot" for all nodes that had a parentNodeID of -1. When I did this, the sitemap did not load at all. I also tried setting all -1 nodes to "1", to match the nodeID of the Home page, but same problem... which I thought was odd.

Ideally, I want the Home page to be the same as "Identity", "Prevent", etc... and not have Identity Prevent and others below Home... However, I will take whatever at this point and worry about that later Smile

Thanks for all your help!

  
  02 Nov 2007, 4:39 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: Trying to bind data from SQL table
You can actually have only one node as the root node. So there will be only one node that has its parentNodeID set to "SitemapRoot". In your case, you should set only Home node's parentNodeID to "SitemapRoot", and other nodes should be its children.

Please take a look at the SitemapSelection sample at http://www.karamasoft.com/Samples.aspx?component=UltimateSitemap&sample=SitemapSelection. As you will down below on the right pane, you can set StartingDepth to a level, or you can use other properties to display portions of your sitemap. For example, if you set StartingDepth to 1 it will display all children of Home.

  
  02 Nov 2007, 4:48 PM
goodfella is not online. Last active: 9/25/2008 1:32:00 AM goodfella

Top 10 Posts
Joined on 04-25-2007
Posts 42
Re: Trying to bind data from SQL table
Thank you. I saw that demo and that helped quite a bit.

I am still having a problem however. The sitemap only displays the "Home" node. All child nodes are not displayed. This is when the ParentNodeID's are set to -1, or whatever node they are a child of. So, whenever Home has child nodes, the sitemap doesnt load and gives the following error: Sitemap source XML cannot be loaded.

When comparing this to the databinding.xml example, all the fields look to be the same, and the parentNodeID's point to valid nodeID's.

Apparently, something is not being understood when it comes to the child nodes.

The XML is below

<?xml version="1.0" standalone="yes"?>
<DataBinding>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>1</nodeID>
<parentNodeID>SitemapRoot</parentNodeID>
<sortOrder>0</sortOrder>
<title>Home</title>
<url>~/content/default.aspx?pud=3d0dd760-a5a0-4ba9-bead-04b298d5e766</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>2</nodeID>
<parentNodeID>1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Identify</title>
<url>~/content/default.aspx?pud=8f88c4c9-ab3d-433b-8d09-74e8c11953ae</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>3</nodeID>
<parentNodeID>1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Prevent</title>
<url>~/content/default.aspx?pud=9f870131-7eac-45ad-8f8e-9f5c2a4c08b8</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>4</nodeID>
<parentNodeID>1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Help</title>
<url>~/content/default.aspx?pud=65d9f270-ae9d-4dcd-8b92-590b2d49ad7b</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>5</nodeID>
<parentNodeID>1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Hot Topics</title>
<url>~/content/default.aspx?pud=5a37988c-a923-43cd-b105-95876da13fe0</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>6</nodeID>
<parentNodeID>1</parentNodeID>
<sortOrder>0</sortOrder>
<title>People of DEA</title>
<url>~/content/default.aspx?pud=efb6a828-f384-4670-b638-10cbf5c2862b</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>7</nodeID>
<parentNodeID>1</parentNodeID>
<sortOrder>0</sortOrder>
<title>Contact Us</title>
<url>~/content/default.aspx?pud=735a4661-fd27-4add-8a67-61e417028271</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>
<UltimateSitemap>
<sitemapID>SiteMap1</sitemapID>
<nodeID>99</nodeID>
<parentNodeID>1</parentNodeID>
<sortOrder>1</sortOrder>
<title>Privacy Policy</title>
<url>~/content/default.aspx?pud=b493ecbb-80bf-4bc8-9f7f-7ccd6f521719</url>
<description />
<nodeCssClass />
<childNodeCssClass />
<nodePrefix />
<nodeSuffix />
<childNodePrefix />
<childNodeSuffix />
<folderClosedImage />
<folderOpenImage />
<columnIndex />
<rowIndex />
</UltimateSitemap>


for (int i = 0; i < iCount; i++)
{
DataRow dr = dt.NewRow();
dr["sitemapID"] = "SiteMap1";
dr["nodeID"] = rgAllIdea.ID.ToString();
if (rgAllIdea.ID == 1)
{
dr["parentNodeID"] = "SitemapRoot";
}
else
{
if (rgAllIdea.ParentPageID == -1)
{
dr["parentNodeID"] = "1";
}
else
{
dr["parentNodeID"] = rgAllIdea.ParentPageID.ToString();
}
}
dr["sortOrder"] = rgAllIdea.Position.ToString();
dr["title"] = rgAllIdea.PageName;
dr["description"] = "";
dr["url"] = "~/content/default.aspx?pud=" + rgAllIdea.GUID;
dr["nodeCssClass"] = "";
dr["childNodeCssClass"] = "";
dr["nodePrefix"] = "";
dr["nodeSuffix"] = "";
dr["childNodePrefix"] = "";
dr["childNodeSuffix"] = "";
dr["folderClosedImage"] = "";
dr["folderOpenImage"] = "";
dr["columnIndex"] = "";
dr["rowIndex"] = "";

dt.Rows.Add(dr);
}

ds.WriteXml("test.xml");

UltimateSitemap1.DataSource = ds;


  
  02 Nov 2007, 6:02 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: Trying to bind data from SQL table
Please send us your test.xml file so that we can look into the problem in our test environment.
  
  02 Nov 2007, 8:37 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: Trying to bind data from SQL table
The problem was the folowing line:

<title>What is "distribution"? What's drug "trafficking?"</title>

You should instead set it to:

<title>What is 'distribution'? What's drug 'trafficking'?</title>

You should also pay attention to SortOrder if you want to specify the item orderings.


  
  03 Nov 2007, 2:43 AM
goodfella is not online. Last active: 9/25/2008 1:32:00 AM goodfella

Top 10 Posts
Joined on 04-25-2007
Posts 42
Re: Trying to bind data from SQL table
Thank you! Worked perfectly! As always, your support and components are awesome!

Just incase anyone else ever needs to convert " to ' in a string, which I have done before and know it can be frustrating, you can do something like:

char chrQuote = (char)34;
string sQuote = chrQuote.ToString();
string sQuoteSingle = "'" // Double Quote Single Quote Double Quote

sTitle = sTitle.Replace(sQuote, sQuoteSingle);

  
 Page 1 of 1 (15 items)
Karamasoft Support Forums » General Discussions » UltimateSitemap » Re: Trying to bind data from SQL table

You can add attachments
You can post new topics
You can reply to topics
You can delete your posts
You can edit your posts
You can create polls
You can vote in polls
Forum statistics are enabled
Forum is unmoderated

© 2002-2018 Karamasoft LLC. All rights reserved.