Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1840
Add additional Groups and Items
posted

Hello,

i use NetAdvantage 10.2.x with Net4.0. I use the WebExplorerBar with a Databinding to a WebHierarchicalDataSource (with a SqlDataSource as Base). I catch the 'itemselected' Event and in the JavaScript i check if it is a child-node and call some different JS-function (i use target-prop of the item to init the code for each item from the database and with eval(target); the fuction is called). This works great for the pattern meneu-item call js-function.

But now i need some menue-items with checkbox behavior or a textbox with a search-button. This should be possible with templates, right?

But how can i add a new group with checkbox-items and a new group with a textbox and a button to the WebExplorerBar??

Thanks

Patric

  • 8160
    posted

    Hello Patric,
    Add new template, then create new group in the code, set the TemplateId to it and add this group to the Groups collection:

    <ig:WebExplorerBar ID="WebExplorerBar1" runat="server" Width="250px" DataSourceID="WebHierarchicalDataSource1"

            GroupContentsHeight="" OnPreRender="WebExplorerBar1_PreRender">

            <ClientEvents ItemSelected="WebExplorerBar1_ItemSelected" />

            <Groups>

                <ig:ExplorerBarGroup GroupContentsHeight="" TemplateId="Template1" Text="GroupA">

                </ig:ExplorerBarGroup>

            </Groups>

            <DataBindings>

                <ig:ExplorerBarItemBinding DataMember="AccessDataSource1_DefaultView" TextField="CategoryName"

                    ValueField="CategoryID" />

                <ig:ExplorerBarItemBinding DataMember="AccessDataSource2_DefaultView" TextField="ProductName"

                    ValueField="ProductID" />

            </DataBindings>

            <Templates>

                <ig:ItemTemplate ID="WebExplorerBar1Template1" runat="server" TemplateID="Template1">

                    <Template>

                        Search:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

                    </Template>

                </ig:ItemTemplate>

            </Templates>

        </ig:WebExplorerBar>

    ...

     

        protected void WebExplorerBar1_PreRender(object sender, EventArgs e)

        {

            // Group 1

            ExplorerBarGroup group = new ExplorerBarGroup();

            //group.Text = "Folders";

            group.TemplateId = "Template1";

            this.WebExplorerBar1.Groups.Add(group);

     

            ExplorerBarItem item = new ExplorerBarItem();

            //item.Text = "Documents";

            item.TemplateId = "Template1";

            group.Items.Add(item);

        }