English 中文(简体)
而不是会议变数,在什么地方可以节省我的时间数据。
原标题:Instead of Session variable where i can save my temp data in mvc?

I have created a mvc3 application. Currently saving submit form value into Session as i need to do some stuff on that before save changes to database.

Is there any other good way to store temp data in mvc like ViewState?

I m saving form input values into Session variable each time when data is entered and and when I clicked on submit button.

每一次提交一次人口众多的会议后,都会有新的附加价值,并将所有这些价值显示为网格。

一旦插入一米,最终就点击了更新的纽顿,它从网格中吸收所有价值,并将一个储存的程序作为参数。

Now here i want to achieve 2 things
1.need to save all inserted data as clicked on submit it gets refresh all time.
so need to save all previous data to.
2.currently using session variable which sets to webgrid to show data into webgrid and once done with insertion passing those values to stored procedure.

因此,需要了解挽救数据的任何其他好办法。

Else can use javascript to do this all on client side.
最佳回答

你们应避免试图使无国籍网络因两个原因似乎具有效力的计划。

首先,DOES NOT会议避免了四舍五入,只是名义上不同于数据库的存储价值。 是的,记忆的热量要快于库克这一直观——到比额表(超过1个服务器)——你必须增加能够减少收益和大大提高复杂性的部件和ho。

Secondly, Session values are likely to make it to a database anyway so why not just start with them there in the first place.

第三(即另一场)会议不一定是信任任何超出隐蔽形式的领域。

13年来,我看到会议几乎完全用于错误的物品——开发商为了方便使用会议而退步,后来对此表示遗憾(替换会议并必须保持其法典的开发商也是如此)。

In short, use a database to store this information and be smart about how you fetch and cache it.

问题回答

http://msdn.microsoft.com/en-us/library/system.web.mvc. Controllerbase.tempdata.aspx”rel=“nofollow” http://msdn.microsoft.com/en-us/library/system.web.mvc. Controllerbase.tempdata.aspx ,但知道这只是从一项要求一直延续到下一次。

TempData["someKey"] = "";

如果你需要坚持所有员额的数据,那么会议是适当的地点。 如果你需要将数据输入数据库,那么该模型应当处理有关员额的数据。 阁下:

[HttpPost]
public ActionResult Index(YourModel model)
{
    if (ModelState.IsValid)
    {
        model.SaveToDataBase();
        return View("Success");
    }
    return View("Index", model);
}

然后在模型中:

[Serializable]
public class YourModel
{
    [Required]
    public string YourData { get; set; }

    public void SaveToDataBase()
    {
         //TODO - add code to call stored procedure with data posted to model
    }
}




相关问题
WebForms and ASP.NET MVC co-existence

I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I ve done to make that happen is that I added a namespaces node to the WebForms web.config: <pages ...

Post back complex object from client side

I m using ASP.NET MVC and Entity Framework. I m going to pass a complex entity to the client side and allow the user to modify it, and post it back to the controller. But I don t know how to do that ...

Create an incremental placeholder in NHaml

What I want to reach is a way to add a script and style placeholder in my master. They will include my initial site.css and jquery.js files. Each haml page or partial can then add their own required ...

asp.net mvc automapper parsing

let s say we have something like this public class Person { public string Name {get; set;} public Country Country {get; set;} } public class PersonViewModel { public Person Person {get; ...

structureMap mocks stub help

I have an BLL that does validation on user input then inserts a parent(PorEO) and then inserts children(PorBoxEO). So there are two calls to the same InsertJCDC. One like this=>InsertJCDC(fakePor)...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

热门标签