开发者

JavaScript iterating through dynamic checkboxes on an aspx page

开发者 https://www.devze.com 2023-04-03 14:10 出处:网络
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

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 fig开发者_Python百科ure 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号