ComponentOne SiteMap for ASP.NET Web Forms
C1SiteMap Features / Add Keyboard Support
In This Topic
    Add Keyboard Support
    In This Topic

    You can add keyboard shortcuts to the SiteMap control by changing the AccessKey property.

    In  the Designer

    Complete the following steps to add keyboard support in Design View.

    1. Open SiteMap Tasks Menu and click Edit Nodes. This opens the C1SiteMap Designer Form.
    2. Select C1SiteMap1 and on the right hand side, set the AccessKey property to a value like 'K'.
    3. Select C1SiteMapNode1 on the left and change the AccessKey property on the right hand side to a value like 'N'.

    In Source View

    Set the AccessKey property inside the <cc1:C1SiteMap> tag, to add a keyboard shortcut to the SiteMap control.

    Copy Code
    <cc1:C1SiteMap ID="C1SiteMap1" runat="server"
        AccessKey="K">
    

    Set the AccessKey property inside the <cc1:C1SiteMapNode> tag, to add keyboard shortcut to a C1SiteMapNode.

    Copy Code
    <cc1:C1SiteMapNode runat="server" Text="C1SiteMapNode1" 
        AccessKey="N">
    

    In Code

    Add the following code to the Page_Load event, to add a keyboard shortcut to the entire control.

    To write code in C#

    C1.SiteMap1.AccessKey= "k";
    

    To write code in Visual Basic

    C1.SiteMap1.AccessKey= "k"
    

    Add the following code to the Page_Load event, to add a keyboard shortcut to individual nodes.

    To write code in C#

    C1SiteMap1.Nodes[0].AccessKey= "a";
    C1SiteMap1.Nodes[0].Nodes[0].AccessKey= "b";
    C1SiteMap1.Nodes[1].AccessKey= "c";
    

    To write code in Visual Basic

    C1SiteMap1.Nodes(0).AccessKey= "a"
    C1SiteMap1.Nodes(0).Nodes(0).AccessKey= "b"
    C1SiteMap1.Nodes(1).AccessKey= "c"
    

    What You've Accomplished

    When you run your project, press ALT + K (AccessKey) to highlight the SiteMap control. Else press Alt + AccessKey for the node, to highlight a particular node.