Category: .NET

Footer from database in MVC ASP.NET

I've been struggling for a while to find a sensible way of getting the footer. Well... This is where partial views come useful. There are several ways to solve this problem. I've created a controller:

In the Shared folder I've added _FooterPartial.cshtml and in the layout this line:

It worked so awesome.

Continue Reading

Partial View not being published

I encountered a bit of a problem today. I've added a partial view manually to the project (i.e. it wasn't generated by the VS). To my annoyance, when I deployed the application to the test server the *.cshtml was not copied. After a bit of digging around, I found the problem. It turned out that

Continue Reading

Razor with JavaScript

Today I had a problem of adding markers onto a google map. I didn't really want to create a service to handle the request and return an array. So instead I tried doing something simpler.

This obviously didn't work. Razor was getting confused; it didn't know which one was the script and which one

Continue Reading

MVC File Upload - Access to the path is denied

An interesting problem occurred yesterday when I was trying to upload a file to the server. I was getting: Access to the path '' is denied The problem wasn't actually caused by the file upload but by my attempt to create a directory to put that file there. After reading a bunch of answers on

Continue Reading

ASP.NET Automatic Migrations

Understanding migrations can be a bit tricky. Hopefully, this article will resolve at least some of the questions you might have. First things first - What are migrations? Well... If you built your website using first code approach every time you change your model you need in order to keep the database in sync. There

Continue Reading

Mapping to a new new Type with ASP.NET Web API and LINQ

As you would expect Microsoft is trying to make your code as clean and need as possible. This is an example of a search query. The key element of this query is select new {Title = m.Name}. It allows you to map a your model to a new type without having to declear a custom

Continue Reading

Publishing WCF Web Service on IIS

Today, I will show you how to to publish WCF Web Service on IIS. I assume your have a working version of your WCF on IIS Express and you want to "publish" it. Step 1 - Install IIS Go to: Control Panel Programs and Features Turn Windows Features On and Off There are 4 things

Continue Reading

Image FadeOut Animation

Today, I decided to play around with WPF a little bit. I created a simple App for animating a logo

Continue Reading

Setting default value for property in EF Code First

There few ways in which one can do it. The simplest way is via data annotations:

Continue Reading

The Output window in VS 2013

I accidentally closed the output 'window' in my VS 2013. I cannot believe it took me that long to find this, but hopefully it will save you some time:

Continue Reading