Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone.

Can anyone suggest me when a user selects a checkbox among multiple checkboxes in a form those selected checkbox should remain selected even when user login next time. how to do this in asp.net.
Posted

You need to save the value in db. and again take from database when user login next time.
 
Share this answer
 
You should have database entry which is having selected checkbox info per user.
So when user login pass userid to query to get selected values.
With using this result you can select checlboxlist.
 
Share this answer
 
The above two solutions already have given you the answer.

I would like to add some more point, how you persist the data in your db and show it in web page,
You should have a table for user settings with userid and settings parameter as db column(s).

When user selects some of the checkbox, iterate a loop and get the selected checkbox id in a comma separated string.
like
checkbox_2, checkbox7,checkbox8

You save the string in your database in user preference table.
While loading the form, check the table, get the string for logged in user id,
make a split and get all the values in string array.

Iterate the loop of all checkbox, match the id, and whenever you see a match, make the checkbox selected.

Hope this give you an overall picture of how to save user preference in db and show it in web page.

Best of luck.
cheers
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900