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
80
WebExplorerBar Databinding to List<Object>
posted

Hi,

I want to use WebExplorerBar to show information of model objects from a service (The service return a list like List<Model>) It is possible create a databinding to a list? The Model object has some attributes like Name, Id.... and I only want to show the name in the WebExplorerBar item. How can I do that?

I tried by this way:

foreach (var model in models )
{
     var item = new ExplorerBarItem { Text = model.PlantName };
      group.Items.Add(item);
}

This runs, but not that what I wanted. Because if I clicked an item, I have no relation to the model object.

Thanks for helping

Parents
  • 37874
    Verified Answer
    posted

    Hi Sunnykid,

    You could bind the WebExplorerBar to a List of custom objects, and then use databindings to set Text and Value fields, for example:

    <DataBindings>
        <ig:ExplorerBarItemBinding TextField="Name" ValueField="ID" />
    </DataBindings>

    Then in ItemClick event, you can access these values like this:

    protected void WebExplorerBar1_ItemClick(object sender, ExplorerBarItemClickEventArgs e)
    {
        string text = e.Item.Text;
        string id = e.Item.Value;
    }

    After that you can get your object directly from the datasource by its ID.

    Hope this helps.

Reply Children
No Data