Hi guys,
Ultimately, I am trying to build an xml string from the checked nodes in the treeview, though I'm having issues trying to retrieve the text and value fields from checked nodes when I have the treeview control bound to a sitemapdatasource and I was hoping you could help me out.
Thanks in advance!
My code-behind looks like:
Where the sitemap file looks like:
My markup is as follows:
Ultimately, I am trying to build an xml string from the checked nodes in the treeview, though I'm having issues trying to retrieve the text and value fields from checked nodes when I have the treeview control bound to a sitemapdatasource and I was hoping you could help me out.
Thanks in advance!
My code-behind looks like:
StringBuilder pagecfg =
new
StringBuilder();
pagecfg.AppendLine(
"<pageconfig>"
);
IList<RadTreeNode> nodeCollection = rtvSitemap.CheckedNodes;
foreach
(RadTreeNode node
in
nodeCollection)
{
pagecfg.AppendLine(
string
.Format(
"<page title='{0}' url='{1}' />"
,node.Text, node.Value));
}
pagecfg.AppendLine(
"</pageconfig>"
);
Where the sitemap file looks like:
<
siteMap
xmlns
=
"http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"
enableLocalization
=
"true"
>
<
siteMapNode
title
=
"$resources:SiteMapLocalizations,HomePageTitle"
url
=
"~/default.aspx"
description
=
"$resources:SiteMapLocalizations,HomePageDescription"
Expanded
=
"false"
/>
<
siteMapNode
title
=
"$resources:SiteMapLocalizations,PartSectionTitle"
url
=
""
description
=
"$resources:SiteMapLocalizations,PartSectionDescription"
Expanded
=
"true"
>
<
siteMapNode
title
=
"$resources:SiteMapLocalizations,PartPageTitle"
url
=
"~/Pages/Production/ProdPart.aspx"
description
=
"$resources:SiteMapLocalizations,PartPageDescription"
SecAccess
=
"Production"
/>
</
siteMapNode
>
</
siteMap
>
My markup is as follows:
<
telerik:RadTreeView
ID
=
"rtvSitemap"
runat
=
"server"
DataSourceID
=
"dsSiteMap"
CheckBoxes
=
"true"
MultipleSelect
=
"true"
CheckChildNodes
=
"True"
DataModelID
=
"Title"
DataNavigateUrlField
=
"Url"
>
<
DataBindings
><
telerik:RadTreeNodeBinding
Expanded
=
"true"
TextField
=
"title"
ValueField
=
"url"
/></
DataBindings
>
</
telerik:RadTreeView
>