Last post Oct 19, 2018 12:21 AM by avt2k7
Oct 14, 2018 09:09 PM|avt2k7|LINK
I used jquery.sumoselect drop-down list to pass the selected country values (American, Canada, Australia, England, and France) for searching all records either using EF or any DI repository that display all distinct records which have the person name has
More details that I posted from a previous thread at https://forums.asp.net/t/2147941.aspx?How+to+pass+multiselect+selected+items+to+a+controller+for+filtering+records
John Doe American
John Doe Canada
Will Smith England
Will Smith Canada
Will Smith France
Jane Chan China
I want to search function to filter all records displays a distinct name, the citizenship concatenates are separated based on a user selected countries from multiselect dropdownlist.
The result will display in the table in partial view as follows:
John Doe American, Canada
Will Smith England, France, Canada
Jane Chan China
How do I create some boolean (true, false) to compare whether or not the person got citizenships and loop through all database records?
Any Idea how to code them, I really appreciate it.
Oct 14, 2018 09:25 PM|mgebhard|LINK
Oct 15, 2018 04:00 AM|avt2k7|LINK
Please look at my previous link https://forums.asp.net/t/2147941.aspx?How+to+pass+multiselect+selected+items+to+a+controller+for+filtering+records
for more details.
I got Records table in the SQL Server database with sample data as follows:
I would like to build a search function that takes the country multiselect selected items as a list of parameters or an array to filter against my sample data in the database. The result of searching will display in the partial view with the format (distinct
Name and concatenate the citizenships) as below:
Oct 15, 2018 10:24 AM|mgebhard|LINK
I'm still not sure what problem you are trying to solve. Your previous post is about passing multi select values to a controller which seems to have been solved by using an string array input in a controller.
Are you asking how to craft a query that uses an array as a an input filter? If so, we need your DB schema or entity models.
If you are asking how to covert a string array to a comma separated string then see the following linq.
var csv = string.Join( ", ", theArray);
Oct 16, 2018 11:53 PM|avt2k7|LINK
There is one simple table named Records ( Name, Citizenship) and the sample data have provided. Thus, a very simple DB schema or entity model.
You can add more properties in the model and help me to build LINQ that produce the result as listed.
Oct 19, 2018 12:21 AM|avt2k7|LINK
I found the way to work around it. Just close it.