Site map : title attribute is not displayed on links

2 posts, 0 answers
  1. jocelyn payneau
    jocelyn payneau avatar
    2 posts
    Member since:
    Dec 2009

    Posted 05 Sep 2010 Link to this post

    Hello,

    I don't manage to display the title attribute on links. Here is my html code:
    <telerik:RadSiteMap runat="server" ID="RadSiteMap1" DataSourceID="SqlDataSource1"
        DataFieldID="SiteMapId" OnNodeDataBound="RadSiteMap1_NodeDataBound"  
        DataFieldParentID="ParentID" DataNavigateUrlField="NavigateUrl" DataTextField="SiteMapTitle" ShowNodeLines="false" >
        <DataBindings>
            <telerik:RadSiteMapNodeBinding NavigateUrlField="NavigateUrl" />
        </DataBindings>
        <LevelSettings>
            <telerik:SiteMapLevelSetting Level="0">
                <ListLayout RepeatColumns="2" AlignRows="true" />
            </telerik:SiteMapLevelSetting>
        </LevelSettings>
    </telerik:RadSiteMap>
      
    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>"
        SelectCommand="SELECT SiteMapId, ParentID, SiteMapTitle, NavigateUrl, SortOrder, SiteMapTitle as Tooltip FROM [SiteMap]">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="SiteMapId" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>

    and my server code:
    protected void RadSiteMap1_NodeDataBound(object sender, RadSiteMapNodeEventArgs e)
        {
            DataRowView nodeData = e.Node.DataItem as DataRowView;
            e.Node.Target = "_self";
      
            e.Node.ToolTip = nodeData["Tooltip"].ToString(); ;
        }

    Thanks for your answers
  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 06 Sep 2010 Link to this post

    Hi jocelyn payneau,

    The problem is that you are trying to add an ALIAS to the SiteMapTitle in the SQL Select Statement. Try the following as an alternative to set the Tooltip equals the SiteMapTitle:

    Remove the alias from the SQL SelectCommand:
    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>"
                SelectCommand="SELECT SiteMapId, ParentID, SiteMapTitle, NavigateUrl, SortOrder, SiteMapTitle as Tooltip FROM [SiteMap]">
                <SelectParameters>
                    <asp:Parameter DefaultValue="1" Name="SiteMapId" Type="Int32" />
                </SelectParameters>
            </asp:SqlDataSource>

    C#: 
    protected void RadSiteMap1_NodeDataBound(object sender, Telerik.Web.UI.RadSiteMapNodeEventArgs e)
        {
            DataRowView nodeData = e.Node.DataItem as DataRowView;
            e.Node.Target = "_self";
      
            e.Node.ToolTip = nodeData["Title"].ToString() + " "; 
        }
     
    Markup remains the same.

    Please let me know if this was helpful.

    Kind regards,
    Veronica Milcheva
    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. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top