Mattersphere Developers Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
Admin
Admin
Posts : 122
Join date : 2018-12-17
https://mattersphere-devs.forumotion.com

Multi Select From A Search List On A Wizard Empty Multi Select From A Search List On A Wizard

Tue 28 Jan 2020 - 9:16
Hi all,
I have a search list control placed on a wizard, multi select is enabled. I was wondering how to access the values of the selected items in code?
Thanks
,Gareth
__________________________________________________________________________________________________________________________________
Code:

FWBS.OMS.UI.Windows.ucSearchControl s = EnquiryForm.GetControl("SearchList1") as FWBS.OMS.UI.Windows.ucSearchControl;
foreach (KeyValueCollection kvc in s.SelectedItems)
{
    System.Windows.Forms.MessageBox.Show(Convert.ToString(kvc["ID"].Value));
}
Hope this Helps
Danny

Cheers for the quick response. I've given it a go and get an 'object reference not set to an instance of an object' error. Just to clarify what I am attempting, I have put this code in the finished event of the wizard.
__________________________________________________________________________________________________________________________________
Hi
Just to confirm. What was the name of the SearchList you put on the wizard. If it is different that SearchList1 then you need to change that part of the code.
Regards
Danny
__________________________________________________________________________________________________________________________________
it is schLayWitnesses, code as follows
Code:

FWBS.OMS.UI.Windows.ucSearchControl s = EnquiryForm.GetControl("schLayWitnesses") as FWBS.OMS.UI.Windows.ucSearchControl;
foreach (KeyValueCollection kvc in s.SelectedItems)
{
    System.Windows.Forms.MessageBox.Show(Convert.ToString(kvc["ID"].Value));
}
__________________________________________________________________________________________________________________________________
It's OK! Fixed!I hadn't changed the name of the key I required from the KVC e.g. changing yours from “ID” to "AssocID".
Thanks for your help with this.Gareth
Back to top
Permissions in this forum:
You cannot reply to topics in this forum