简体   繁体   中英

Setting selected value of a list box from a comma-separated string using linq C#

I have a selection pop up in which user select his criteria from various list boxes, once he close the popup, if user closes Pop up and it returns to main screen, again if he needs to change some other filters he wants to see previous selected items from those listboxes. I am doing it by using Session values which contain comma-separated selected values and setting them by using for loop. I want to know is there any best way to do it instead of For loop, which helps in increase of performance? Please I need your kind suggestions on this.

Thank you,

Sharath

It is not completely clear where you are going but from what I understand you have a list of options that are stored in csl, and these need to populate the list box. The quick answer is don't store data that way but rather make a class with the data and a list of objects to store the data. After that sorting or selecting the data to show is not a problem using the Select function in Linq...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM