asp.net-mvc


c# - Test method is inconclusive: Test wasn't run. Error?

Just in case none of the above options worked for anyone I fixed my instance of this error by noticing a corrupt entry in my App.Config due to a missing nuget package in the test project.... Read More


ASP.NET MVC: What is the purpose of @section?

@section is for defining a content are override from a shared view. Basically, it is a way for you to adjust your shared view (similar to a Master Page in Web Forms). You might find Scott Gu's write... Read More


c# - Why isn't there a Guid.IsNullOrEmpty() method

Guid is a value type, so a variable of type Guid can't be null to start with. If you want to know if it's the same as the empty guid, you can just use: if (guid == Guid.Empty)... Read More


ASP.NET MVC - TempData - Good or bad practice

No need to have an aversion to TempData... But if not used correctly it could surely be an indication of poor design. If you are using RESTful URL's, TempData is a best practice for transfering messa... Read More


asp.net mvc - How to access javascript variable within @URL.Action()

You can't. JavaScript doesn't execute when generating the action URL. What you can do, is do something like this: function name(myjavascriptID) { var link = '@Url.Action("download file", "dow... Read More


Html5 data-* with asp.net mvc TextboxFor html attributes

You could use underscore (_) and the helper is intelligent enough to do the rest: @Html.TextBoxFor( model => model.Country.CountryName, new { data_url = Url.Action("CountryContains", "Geo")... Read More


c# - VS 2017 Metadata file '.dll could not be found

The problem was that I had some other normal error messages in my project, and apparently after I fixed those and when I cleaned and built my project AGAIN, then all .dlls succeeded. Make sure you do... Read More


asp.net mvc - Html5 Placeholders with .NET MVC 3 Razor EditorFor extension?

As smnbss comments in Darin Dimitrov's answer, Prompt exists for exactly this purpose, so there is no need to create a custom attribute. From the the documentation: Gets or sets a value that will be... Read More


twitter bootstrap - ASP.NET Actionlink with glyphicon and text with different font

You should not add the glyphicon class to the a-tag. From the Bootstrap website: Don't mix with other components Icon classes cannot be directly combined with other components. They should not be u... Read More


.net - What does Html.HiddenFor do?

It creates a hidden input on the form for the field (from your model) that you pass it. It is useful for fields in your Model/ViewModel that you need to persist on the page and have passed back when... Read More