Skip to main content
Tab

NavBarGroup(String, String, String, String, String) Constructor

Initializes a new instance of the NavBarGroup class with the specified settings.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

public NavBarGroup(
    string text,
    string name,
    string imageUrl,
    string navigateUrl,
    string target
)

Parameters

Name Type Description
text String

A String value specifying the group’s display text. Initializes the group’s NavBarGroup.Text property.

name String

A String value specifying the name which indentifies the created group. Initializes the group’s NavBarGroup.Name property.

imageUrl String

A String value specifying the path to the image displayed by the group’s header. Initializes the ImagePropertiesBase.Url property of the group’s NavBarGroup.HeaderImage.

navigateUrl String

A String value specifying the URL to which the browser navigates when the group’s text or associated image is clicked. Initializes the group’s NavBarGroup.NavigateUrl property.

target String

A String value which identifies the window or frame at which to target URL content when the group’s text or associated image is clicked. Initializes the group’s NavBarGroup.Target property.

Remarks

Use this constructor to initialize a new instance of a NavBarGroup class using the settings passed via the parameters.

Example

This example demonstrates how to modify the ASPxNavBar‘s item content.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxNavBar" tagprefix="dxnb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxNavBar;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e){
        ASPxNavBar1.AccessibilityCompliant = true;
        NavBarGroup group1 = new NavBarGroup();
        group1.Text = "Help";
        NavBarGroup group2 = new NavBarGroup("Contacts", "contacts", 
             "~/Images/contacts.gif", "contacts.aspx", "_blanc");
        NavBarItem item1 = new NavBarItem("Search");
        NavBarItem item2 = new NavBarItem("FAQ", "faq", "~/Images/faq.gif", 
             "Faq.aspx", "_blanc");
        NavBarItem item3 = new NavBarItem("Forum", "forum", "~/Images/Forum.gif",
             "~/Forum/Default.aspx");
        item3.Target = "_blanc";      


        ASPxNavBar1.Groups.Add(group1);
        ASPxNavBar1.Groups.Add(group2);
        group1.Items.Add(item1);
        group1.Items.Add(item2);
        group1.Items.Add(item3);

        item1.Template = new MyTemplate();
    }

    public class MyTemplate : ITemplate {
        void ITemplate.InstantiateIn(Control container) {
            ASPxTextBox MyTextBox = new ASPxTextBox();
            MyTextBox.Text = "";
            ASPxButton SearchButton = new ASPxButton();
            SearchButton.Text = "Search..";
            SearchButton.AutoPostBack = false;
            container.Controls.Add(MyTextBox);
            container.Controls.Add(SearchButton);
        }
    }
}

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <dxnb:ASPxNavBar ID="ASPxNavBar1" runat="server">
        </dxnb:ASPxNavBar>

    </div>
    </form>
</body>
</html>
See Also