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
25
Dynamically set the items and template of ExplorerBarItems
posted

I have a need to add items at runtime to a WebExplorerBar and the items would be user controls.  I have been able to add a group and an item however I cannot figure out how to set the template for the item to allow me to add the user control.  I don't know if I am just doing this wrong or if I am in the wrong part of the page life cycle.  I need to have multiple User controls per page and they could be the same control just being loaded from different data sources.  Any help would be great.

I am using VS 2010 and 10.1 of Infragistics asp.net controls

Here is a sample of the code I am trying:

 

 

protected void Page_Load(object sender, EventArgs e)

    {

        ExplorerBarGroup group = new ExplorerBarGroup("parameter1");

        ExplorerBarItem item = new ExplorerBarItem("CheckBoxTest");

        CheckBox chk = new CheckBox();

        chk.Text = "Test";

        ItemTemplate it = new ItemTemplate();

        it.TemplateID = "testTemplateId";

        it.Controls.Add(chk);

        WebExplorerBar1.Templates.Add(it);

        item.TemplateId = it.TemplateID;

        group.Items.Add(item);

        WebExplorerBar1.Groups.Add(group);   

    }