Using the NavigationControl
Hi,
I'm attempting to create a WebUserControl that renders my navigation. For this, I'm using the following code:
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" TagPrefix="nav" %>
<
nav:NavigationControl
runat
=
"server"
ID
=
"navcontrol1"
NavigationMode
=
"VerticalTree"
NavigationAction
=
"OnClick"
SelectionMode
=
"SelectedPages"
></
nav:NavigationControl
>
Telerik.Sitefinity.Web.UI
controls? Having attribute definition and sample code for each would be a huge help.Any ideas on this issue? Worst case, I can build my own navigation using the API, but I'd like to avoid doing that if at all possible.
thanks
Hello Chris,
It's not a problem at all to use the built-in Navigation on a page. The reason why you're not seeing any pages is because you have set SelectionMode="SelectedPages" and the Navigation control is expecting you to define the pages you want it to display in the code behind. That's a tough one, though - you have to pass them in a deserialized object format, for example:
[
"__type"
:
"Telerik.Sitefinity.Web.UI.NavigationControls.SelectedPage"
,
"Title"
:
"FirstPage"
,
"Id"
:
"51993226-0196-436b-99c4-dc858a860634"
,
"Url"
:
null
,
"IsExternal"
:
false
,
"__type"
:
"Telerik.Sitefinity.Web.UI.NavigationControls.SelectedPage"
,
"Title"
:
"IndexChanged"
,
"Id"
:
"c6cd70f7-b38e-4535-86ce-257a5ba6c253"
,
"Url"
:
null
,
"IsExternal"
:
false
]
protected
void
Page_Load(
object
sender, EventArgs e)
var myvalue =
"[\"__type\":\"Telerik.Sitefinity.Web.UI.NavigationControls.SelectedPage\",\"Title\":\"FirstPage\",\"Id\":\"51993226-0196-436b-99c4-dc858a860634\",\"Url\":null,\"IsExternal\":false,\"__type\":\"Telerik.Sitefinity.Web.UI.NavigationControls.SelectedPage\",\"Title\":\"IndexChanged\",\"Id\":\"c6cd70f7-b38e-4535-86ce-257a5ba6c253\",\"Url\":null,\"IsExternal\":false]"
;
this
.CustomSelectedPages = myvalue;