substituting widget layouts
So in the navigation widget, theres a place to specify a "Custom Template Path". Its a textbox that is apparently looking for a .net user control (ascx) file.
Hi Aaron,
NavigationControl has its own binding that applies over a control that you will declare in the ascx file. In your template you should have BaseDataBoundControl which has a DataSource property that we set to the SiteMapDataSource. If you do not have a BaseDataBoundControl in your template, you will get an ArgumentException. You might find this post useful.
Kind regards,
Ivan Dimitrov
the Telerik team
just to be clear, i'm not necesarily looking for a way to create an entirely new navigation control. The built in navigation works just fine... I just need a way to skin, or theme it entirely. Right now, it seems that no matter how much styling we apply, the control itself has some embedded styling that overrides whatever we're doing.
if createing a new control is the only way to accomplish this, then would you have any samples of these usercontrols? This also begs the question- If i'm creating my own sitemap bound navigation usercontrol... why do i need to add a navigation widget to the page in the first place, and then specify my usercontrol's path in the navigation widget's custom template layout field??
If this is the process, i'd much rather just drop my custom nav usercontrol into my master page markup, and axe the navigation widget alltogether.
Hello Aaron,
1. The control expose Skin and SkinID properties which you can use directly and the control will be styles. You can take a look at the short video that I attached.
2. If you have a custom control you should bind it manually, since our control will do this automatically and will allow you to use other properties exposed by the designer.
Regards,
Ivan Dimitrov
the Telerik team
could you post more information about the manual binding in the custom control... or an example of how its done?
theres a lot going on behind the scenes in sitefinity, and without more documentation, i'm pretty much in a giant trial n error process.
for instance... can i simply...
<ListView>
<ItemTemplate>
<ul>
<li><%# Eval("some nav node") %>
</ul>
</ItemTemplate>
</Listview>
then set the control's datasource to be the sitemapds.
thanks
Hello Aaron,
You can use Eval only with a properties/fields associated with your the data item of your data source - <%# Eval("PropertyName") %>
sample
<
asp:ListView
runat
=
"server"
ID
=
"ListView"
>
<
ItemTemplate
>
<
ul
>
<
li
><%# Eval("Title") %>
</
ul
>
</
ItemTemplate
>
</
asp:ListView
>
yes, i know how to bind properties... my problem is figuring out how to bind properties to a sitefinity datasource.
this is as explicit as i can make this...
usercontrol-
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Navigation.ascx.cs" Inherits="SitefinityWebApp.Navigation" %>
<telerik:RadPanelBar ID="RadPanelbarNav" runat="server"></telerik:RadPanelBar>
codebehind-namespace SitefinityWebApp
public partial class Navigation : System.Web.UI.UserControl
public BaseDataBoundControl control get; set;
protected void Page_Load(object sender, EventArgs e)
with this code alone... i CAN see navigation... which is great!!
however-
i don't want to use the RadPanelBar to display my navigation, because i want to define the layout myself. br, h1, tr, td, and so on, wrapped inside a nice repeater or listview.
Now in order to do that, i need to know how i can bind to the (sitemapdatasource?) manually in the markup or codebehind.
I've put breakpoints Everywhere- BaseDataBoundControl's getter and setter are never hit. And during the Databinding, Databound, and ItemDatabound events, the datasource is always null.
HOWEVER!!!! I still see RadPanelBar navigation on the page.
How can i access BaseDataBound's datasource. At least if i can get to that, i can do some C# acrobatics to pull the data and bind it to something else.
I need to know what sitefinity is doing in the background so that i can work either With or Around it.
Better yet... is there a way to manually grab the sitemapdatasource that sitefinity creates?? if i can get to that, i can circumvent sitefinity's navigation altogether.
Hello Aaron,
You can use a sitemap data source control and bind a repeater to it. Bellow is some sample markup:
<
asp:Repeater
ID
=
"Repeater1"
runat
=
"server"
DataSourceID
=
"SiteMapDataSource1"
>
<
HeaderTemplate
>
<
ul
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
li
>
<
asp:HyperLink
runat
=
"server"
NavigateUrl='<%# Eval("Url") %>'><%#Eval ("Title") %></
asp:HyperLink
>
</
li
>
</
ItemTemplate
>
<
FooterTemplate
>
</
ul
>
</
FooterTemplate
>
</
asp:Repeater
>
<
asp:SiteMapDataSource
runat
=
"server"
ID
=
"SiteMapDataSource1"
ShowStartingNode
=
"false"
/>
"Unable to find a BaseDataBoundControl derived control in the tempalate"
OOOOooooohhh!!!
Hi Aaron,
1. You see the error because you are not using a BaseDataBoundControl . If you do not have a BaseDataBoundControl in your template, you will get an ArgumentException.")
2. The type in the ArgumentException was fixed.
3. If you want to use the NavigationControl and suppress the check for BaseDataBound control and stop the auto binding you have to create a custom class that inherits from NavigationControl and override its InitializeControls method which is equivalent to create a custom control that uses SiteMapDataSource().
If there are any further question, lease let me know about them.
Best wishes,
Ivan Dimitrov
the Telerik team