I am trying bind WindnavigationBar to a dataset
My code is as below
{
this.product_groupTableAdapter1.Fill(this.thunderCommerceDataSet1.Product_group);
Infragistics.Win.Misc.UltraNavigationBarLocation location;
location = new Infragistics.Win.Misc.UltraNavigationBarLocation(items[1].ToString());
location.Locations.Add(childItems[0].ToString());}}}}}
I am getting an error "Key already existsParameter name: Key" in this line
this.ultraNavigationBar1.RootLocation.Locations.Add(location);
What is wrong with my code?
The overload of the Add method that you used is setting the Key property, which has to be unique across the collection. There is another overload that takes two strings; the first is the key and the second is the value of the Text property. You should use this overload, specify null as the value of the first parameter (key), and assign childItems[0].ToString() as the value of the second parameter.