humnbass
humnbass

Reputation: 21

JavaScript iterating through dynamic checkboxes on an aspx page

I have an aspx page that has dynamically created checkboxes. I'm trying to find a way to keep the state of this page (checkboxes that are checked to remain checked) when I hit the navigation button to go to the previous page. The problem is when I go from the previous page back to the page with the checkboxes I lose all of the values. I understand why I lose them but I can't figure out how to retain them. I was thinking about saving the ids of the boxes that are checked in a table but there just have to be a better way. Any help would be appreciated.

Upvotes: 1

Views: 85

Answers (1)

Joshua
Joshua

Reputation: 5514

If you want to keep the data for a long time, then storing in a table is absolutely the right approach.

If you only need to store them temporarily, then storing the data in a session variable would be a good option.

You could also store the values directly in a cookie, which would give you the option to use either server side code or javascript to set the checkboxes.

Upvotes: 1

Related Questions