Store Form Field Data Temporarily
ASP.Net MVC 3 using C#
I currently have开发者_开发知识库 a form with some dropdown lists populated by a database. If someone wants to add a new item to that dropdown list I need to take them to another form then bring them back. Is there anyway I can do this without rigging it with session variables? Or maybe a way to do it using Ajax to open the 2nd form?
Thanks.
You can use TempData
for this. Although, deep down, TempData
uses session store but that's abstracted to you via TempData
.
Going Ajax route is also an option but with so little description, its hard to tell anything in detail.
You can use Model Pop-up for adding item into dropdown.
You can also use a popup panel to update the value. Since you're taking the user to a whole new page, I assume there is a lot of logic or prerequisites before they're allowed to add a new value.
You can easily move the logic into a control and throw that control into a panel for the page. The bonus is that you can also throw it on the existing page, just in case that page is used as part of another function flow.
精彩评论