//when source 1 is changed, the associated objects and entities are added to their respective ddls protected void SourceDropDown_SelectedIndexChanged(object sender, EventArgs e) { // clears the drop down lists when the user changes the source // (OS) ObjectDropDown.Items.Clear(); CounterDropDown.Items.Clear(); ServerDropDown.Items.Clear(); ResultsListBox.Items.Clear(); // (TB) CorrelatorService service = new CorrelatorService(); List<OCMObject> objects = service.getObjects(int.Parse(SourceDropDown.SelectedValue)); // add items to 1st object list, dependent on source foreach (OCMObject obj in objects) ObjectDropDown.Items.Add(new ListItem(obj.name, obj.name)); List<OCMEntity> entities = service.getEntities(int.Parse(SourceDropDown.SelectedValue)); // add items to 1st entity list, dependent on source foreach (OCMEntity entity in entities) ServerDropDown.Items.Add(new ListItem(entity.name, entity.id.ToString())); }
// When counter 1 is changed, the associated entities are shown in the object ddl // (OS) protected void CounterDropDown_SelectedIndexChanged(object sender, EventArgs e) { CorrelatorService service = new CorrelatorService(); List<OCMEntity> entities = service.getEntities(int.Parse(SourceDropDown.SelectedValue)); //add items to 1st entity list foreach (OCMEntity entity in entities) ServerDropDown.Items.Add(new ListItem(entity.name, entity.id.ToString())); }
// When source 2 is changed, the associated objects are shown in the 2nd object ddl // (OS) protected void SourceDropDown2_SelectedIndexChanged(object sender, EventArgs e) { ObjectDropDown2.Items.Clear(); CounterDropDown2.Items.Clear(); ServerDropDown2.Items.Clear(); ResultsListBox2.Items.Clear(); CorrelatorService service = new CorrelatorService(); List<OCMObject> objects = service.getObjects(int.Parse(SourceDropDown2.SelectedValue)); //using value from SourceDropDown2 //add items to second Objects list foreach (OCMObject obj in objects) ObjectDropDown2.Items.Add(new ListItem(obj.name, obj.name)); List<OCMEntity> entities = service.getEntities(int.Parse(SourceDropDown2.SelectedValue)); //add items to 1st entity list, dependent on source foreach (OCMEntity entity in entities) ServerDropDown2.Items.Add(new ListItem(entity.name, entity.id.ToString())); }
// When counter 2 is changed, the associated objects are stored in the 2nd object ddl // (OS) protected void CounterDropDown2_SelectedIndexChanged(object sender, EventArgs e) { CorrelatorService service = new CorrelatorService(); List<OCMEntity> entities = service.getEntities(int.Parse(SourceDropDown2.SelectedValue)); //add items to second object list, dependent on the source foreach (OCMEntity entity in entities) ObjectDropDown2.Items.Add(new ListItem(entity.name, entity.id.ToString())); }