开发者

What is best option to store multiple items from related entity before saving form

I have ASP.NET page with form 'Add Student' which is data-bound to Students table. User can select many languages (from drop-down bound to Languages table) that this user 开发者_如何学运维speak and add them to list/grid. After saving whole form, all values are saved to tables Students and related StudentLanguages. My problem is that before saving form, there can be multiple postbacks (adding language, validation, etc) and I need to store so far selected languages somewhere. I cannot store them in the table StudentLanguages because a Student record does not exist yet. What is the best option? Using page property LanguagesList and adding it to Session object every postback?


If all Student's information and the languages are added at the same page, storing languages in a generic list collaction and saving it into ViewState is fine. After navigating another page you don't need to deal with the remaining objects at the session.

But if these languages are added at another page, session is fine.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜