ViewBag, ViewData and TempData

1)TempData Allows you to store data that will survive for a redirect. Internally it uses the Session as backing store, after the redirect is made the data is automatically evicted. The pattern is the following: public ActionResult Foo() { // store something into the tempdata that will be available during a single redirect TempData[“foo”] = … Read more

What is the @Html.DisplayFor syntax for?

Html.DisplayFor() will render the DisplayTemplate that matches the property’s type. If it can’t find any, I suppose it invokes .ToString(). If you don’t know about display templates, they’re partial views that can be put in a DisplayTemplates folder inside the view folder associated to a controller. Example: If you create a view named String.cshtml inside … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)