开发者

Drawing a part of a page only after another part was "submitted"

开发者_运维知识库

ASP.NET MVC noob here

I was writing a quiz application where a user can select her preferences (e.g. difficulty, number of question etc.), and once she hit a submit button - she got a new page with questions.

The preferences are represented as a "Preferences" object, and the questions are IEnumerable of Question.

This all worked well.

Now I decide both parts should be in the same page - and I don't know how to accomplish that:

Should I have a new model class that is a composition of these two parts?

And also - How will I make the "questions" part appear only after the user completed filling up her preferences and clicked a button?

Should I use AJAX?

I also read a little about partial views and RenderSection.. But I really couldn't understand which approach is the most appropriate for my scenario.

So how should I draw two parts of a page, where the second is only displayed after the first is submitted?

Thanks.


How familiar are you with AJAX? If I had to guess I would think a good way to do what you want to do is to have an AJAX call which is linked to an action when the user submits their preferences. The action can then return a partial view which you can have appear on the page without a reload via AJAX.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜