Let’s say your’re trying to run your MVC application in Visual Studio, but you get the error in the subject line whether you run it with our without debugging. If you search for a solution to the problem, just about all you’ll see over and over is to set your Web project as the ‘Startup […]
In the output window, I started getting notices for every dll in the references like: “‘iisexpress.exe’ (Managed (v4.0.30319)): Loaded ‘C:\Windows\Microsoft.Net\assembly\GAC_32\” among all kinds of notices – literally a website that took normally a few second to load during debugging sometimes took minutes or didn’t load at all.
If you have html line breaks, links or other HTML tags that you’d like to use in a ViewBag, it’s not as hard as it seems. At first I tried Html.Encode/Decode, but that didn’t work. It seemed like the things I tried just kept adding to a list of items that proved you couldn’t do […]
Let’s say you’re getting data from a database, and some of the data is null (maybe it’s an integer). A very common approach is to iterate through a table: dtEmployees = emp.Get(sqlGetEmployees); foreach (DataRow drEmp in dtEmployees.Rows) … ptt.Fieldname = drEmp[“Fieldname”] != DBNull.Value ? int.Parse(drEmp[“Fieldname”].ToString()) :0; That will populate the page with a ‘0’ for […]
In WebForms, first we had a DataGrid and then the GridView that we relied on for our grid type presentations. Well, once we started using MVC, it was a little more difficult since there are no ‘controls’ per se.
Everyone using MVC generally knows about the ‘Required’ attribute for properties in the model. It’s surrounded by square brackets and placed just above the property. However, what if you want to change the displayed message to more user-friendly text? Well, it turns out that it’s very easy.
Let’s say you have a TextBoxFor in your page to display a date (based on DateTime in the model): @Html.TextBoxFor(model => model.dateFrom) But, since it just displays something like “1/1/0001 12:00:00 AM“, you probably don’t like that.
All Things DotNet Discussed – Winforms/ASP.Net/SharePoint/WPF