Wednesday 15 February 2012

jquery - Extract tempdata or viewdata value in javascript? -


How do I remove tempdata or viewdata value in javascript? It returns "" even if value is being set. Is syntax wrong? I have tried without having to cast 'string' and except that anything seems to work ...

  var message = '@TempData ["message"]';    

Even if a value is being set. "/ P>

Are you sure you have some value in TempData ?

Check this and then make sure you Are doing the right way.

  • TempData is meant to be a very short-lived example, and you only have to do this during the existing and subsequent requests
  • Since TempData works in this way, you should know about it to make sure that the next un The only time you can guarantee this is to stop, and to redirect to another view.
  • Therefore, only when using << TempData Work will be done reliably when you are redirecting. It is because a redirect hits the current request, then creates a new request on the server to serve the redirect view.
  • Just said, asp.Net MVC TempData Dictionary The control is used to share data between tasks.
  • The value of TempData remains until it is read or the current user Until the session time.
  • By default, save TempData its contents are in session state.
  • TempData values ​​are marked to be deleted when you read them. At the end of the request, any marked value is removed.
  • The advantage is that if you have a series of multiple redirections, then due to being TempData , the empty values ​​may still be there, unless you actually Do not use it, then they automatically clean themselves.

No comments:

Post a Comment