Question

I have a big form loaded in asp.net mvc. My form has some pages and each page has some questions and each question has some choices.

I want to load a form and all of its items for a user but it's so large and slow. There are these choices for me:

  1. Cache in server : but for some users questions must be randomly or dynamically chosen.

  2. Make html page and store in server

Do you have any solution or any links to get better performance from MVC in loading big forms.

Was it helpful?

Solution

It really depends on the way you structure your "form pages". I see here two situations: the number of "pages" is known (constant) and relatively small or you have an unknown number of "form pages".

In the first case, I would recommend a tab display structure, where each "page" is a tab. The content of each tab would be lazy loaded (using Ajax) when the user selects it. That way you don't have to load all the pages and questions from start. As an additional random thought, the submit button would be disabled until all the questions have been answered; that way, the user cannon submit a "partial form".

In the second case, you could opt for a Next Page approach, where you present the user the possibility of navigating to the "next page" of questions. Before loading the next page, you would generate hidden fields containing the results of the current page, so that you don't loose your form data and can successfully submit all your questions and answers.

Addressing your question points: When randomness is involved, I see no straight forward solutions. You cannot and should not generate a page for every possible combination available (either static or in cache). This might work for a relatively small number of pages and question but I can't really see it as a viable solution. The scenario you described fits to the "Ajax requests architecture" (I made this expression up, but that's what it basically is: Ajax centric design).

Edit: a third solution would be to serialize all your questions and answers into a Json object and gradually render the questions into your page. The downside of this solution is that you would have to implement a lot of the logic in JavaScript.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top