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 citizenships.
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
For example:
Name Citizenship
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:
NameCitizenships
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.
I got Records table in the SQL Server database with sample data as follows:
NameCitizenship
John Doe American
John Doe Canada
Will Smith England
Will Smith Canada
Will Smith France
Jane Chan China
etc..
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:
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.
Member
166 Points
407 Posts
Custom search in ASP.NET MVC. C#
Oct 14, 2018 09:09 PM|avt2k7|LINK
Hi,
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 citizenships.
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
For example:
Name Citizenship
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:
Name Citizenships
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.
All-Star
36941 Points
14923 Posts
Re: Custom search in ASP.NET MVC. C#
Oct 14, 2018 09:25 PM|mgebhard|LINK
Just craft a view model with a name property and a list of string to hold the country. Other than that I’m not sure what your trying to.
Member
166 Points
407 Posts
Re: Custom search in ASP.NET MVC. C#
Oct 15, 2018 04:00 AM|avt2k7|LINK
Hello,
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:
Name Citizenship
John Doe American
John Doe Canada
Will Smith England
Will Smith Canada
Will Smith France
Jane Chan China
etc..
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:
Name Citizenships
John Doe American, Canada
Will Smith England, France, Canada
Jane Chan China
etc.
Thanks.
All-Star
36941 Points
14923 Posts
Re: Custom search in ASP.NET MVC. C#
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.
Member
166 Points
407 Posts
Re: Custom search in ASP.NET MVC. C#
Oct 16, 2018 11:53 PM|avt2k7|LINK
Hello,
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.
Thanks.
Member
166 Points
407 Posts
Re: Custom search in ASP.NET MVC. C#
Oct 19, 2018 12:21 AM|avt2k7|LINK
I found the way to work around it. Just close it.