This is a migrated thread and some comments may be shown as answers.

Site map : title attribute is not displayed on links

1 Answer 64 Views
SiteMap
This is a migrated thread and some comments may be shown as answers.
jocelyn payneau
Top achievements
Rank 1
jocelyn payneau asked on 05 Sep 2010, 09:42 AM
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

1 Answer, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 06 Sep 2010, 01:48 PM
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
Tags
SiteMap
Asked by
jocelyn payneau
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Share this question
or