Saturday, March 24, 2012

Maintaining State of a web page

I am building a forum asp vj#. I would like to maintain the state of the expanded messages after I post a reply and then go back to the messages in that thread. Ant Ideas?On these forums, the post reply button is a hyperlink. It includes a querystring that indicates the current thread/post. Can you do something like this?
I had an idea that may work, but I am concerned about the use of resources. I will explain what I am thinking here. When a topic is chosen, the first thing the user see's is a list of all of the direct replies to the topic and an "View replies button" that expands the first level of replies to the message. This "View replies button is visible for every message that has replies to it. It is kind of a Tree idea". The user can expand and hide replies to messages at will. My idea is that each time the user expands a message, the messages ID is put into a Dynamic array, and each time the user collapses the tree the Message ID is removed fro mthe array. Then when a user chooses to reply to a message the dynamic array is put into the Session then after the user posts the message and sent back to the view replies page, the array is read and each ID number that is in the array the replies to is are expanded. My concern in that this kind of work will be to server intensive and cause problems. Any thoughts?

If all you're storing in sesssion state is the id, then I don't see a problem with this idea as long as the application is running on a single server/website. The array of ID's should not require too much memory that performance would be affected on the server. It would be different if you were storing the entire contents of each message in a session variable.

Does this answer your question?

0 comments:

Post a Comment