1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / substituting widget layouts

substituting widget layouts

11 posts, 0 answered
  1. Aaron
    Aaron avatar
    10 posts
    Registered:
    03 Sep 2010
    20 Oct 2010
    Link to this post
    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.

    I'm new to sitefinity so i may be wrong, but this seems like its a way to specify a custom made layout for the navigation widget.  Which i then hope would mean that we could implement our own design, ignoring any of the embedded layout and styling in the widget.

    If it indeed works this way, i haven't been able to find any documentation about how to create this template.
    What does the template structure look like?
    Where should data binding tags go, if they even are supposed to go in there?
    What should they bind to?

    and other such questions.... 

    if anyone can kick me in the right direction, it'd be appreciated.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    20 Oct 2010
    Link to this post
    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
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Aaron
    Aaron avatar
    10 posts
    Registered:
    03 Sep 2010
    21 Oct 2010
    Link to this post
    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.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    21 Oct 2010
    Link to this post
    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
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Aaron
    Aaron avatar
    10 posts
    Registered:
    03 Sep 2010
    21 Oct 2010
    Link to this post
    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
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    21 Oct 2010
    Link to this post
    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>


    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Aaron
    Aaron avatar
    10 posts
    Registered:
    03 Sep 2010
    21 Oct 2010
    Link to this post
    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 { getset; }

            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.
  8. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    22 Oct 2010
    Link to this post
    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"/>



    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Aaron
    Aaron avatar
    10 posts
    Registered:
    03 Sep 2010
    22 Oct 2010
    Link to this post
    "Unable to find a BaseDataBoundControl derived control in the tempalate"

    not kidding... it says "tempALAte" in the error text on the page.

    i know the asp repeater is not derived from basedataboundcontrol, but i actually copy n pasted your markup in verbatim... not because i thought it would work, but because i want to try to clarify the issue here.

    i don't need you guys to give me .NET lessons.  i'm fully capable of creating databound controls.  the problem is that because of the lack of documentation for the beta (or my inability to locate it), i'm unable to figure out how to INTEGRATE my .net code/controls with sitefinity.  Entirely because I don't know what to give/get/hook into in sitefinity to get it to play nicely with custom code.

    so... what would i do to this repeater to get Sitefinity to play nicely with it.

    and just so we're clear, if you guys respond with more generic .net code, i'm copy n pasting it into the page verbatim again..  ;)
  10. Aaron
    Aaron avatar
    10 posts
    Registered:
    03 Sep 2010
    22 Oct 2010
    Link to this post
    OOOOooooohhh!!!

    is there a method that SF executes to bind the page control to the datasource THAT I CAN OVERRIDE?????

    it would be amazing if i could stop the default binding and do it myself.
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    22 Oct 2010
    Link to this post
    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
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
11 posts, 0 answered