Hello,
I'm trying to make a site which allow users to create surveys.
It's an assignment from school, so I'm not asking for code, just for guidance.
It has to be done in an object-oriented way.
When you save a question, it goes into an array of a class. So every time a question is saved, it is stored into that array. But whenever the page reloads, the object is null and the only question stored is the last one that was added.
I have tried using viewstate and a session, but I still get the null error.
How do I keep my object from going null when the website does a postback?
Thanks in advance!
I've done this with viewstate:
ViewState["Survey"] = Enq (Which is the survey object)
then when the page loads I do the following:
Enq = ViewState["Survey"]
Note that the Enq is declared on class level (if I said it right).
The same thing with session.
I'm trying to make a site which allow users to create surveys.
It's an assignment from school, so I'm not asking for code, just for guidance.
It has to be done in an object-oriented way.
When you save a question, it goes into an array of a class. So every time a question is saved, it is stored into that array. But whenever the page reloads, the object is null and the only question stored is the last one that was added.
I have tried using viewstate and a session, but I still get the null error.
How do I keep my object from going null when the website does a postback?
Thanks in advance!
I've done this with viewstate:
ViewState["Survey"] = Enq (Which is the survey object)
then when the page loads I do the following:
Enq = ViewState["Survey"]
Note that the Enq is declared on class level (if I said it right).
The same thing with session.