When adding a Constructor to a C# class, other than doing it manually, instead, there is a very easy shortcut. just type in the letters ‘ctor’ and then follow it by two tabs. Voila, you have a perfectly formed constructor, including the name and curly braces!
You’ve just entered a new stored procedure and you run your web page which uses it and WHAM! – you get this error message. Luckily, it’s not too bad.
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 .Net, sometimes, you must work with a querystring with many parameters and then, based on that, you must assign values to labels, textboxes or the like. Fortunately, it’s not that hard. Here, I’ll break it down into three parts – grabbing the entire querystring and then getting the individual parameters, followed by assigning them […]
Recently, I found out our SQL Server was storing events in UTC time. An application I was creating needed to get a list of events that happened on a certain certain day. Since our Central Standard Time was a little off, I had to come up with a fix for this. I had a parameter […]
Let’s say you’re on a computer with which you need a website on a server to have information about. First, you want the computer name you’re on. In my case, I ran the page on the website from a remote computer and I needed a textbox to default to the computer name where I was. […]
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 still use VB.Net. Also, for some reason you notice that your ‘Me’ keyword no longer works (not recognized by intellisense) and that your application startup subroutines errors out and says “Event ‘Startup’ cannot be found”. It sounds really catastrophic, but for me, it wasn’t that big a deal. In the Application button […]
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 […]
All Things DotNet Discussed – Winforms/ASP.Net/SharePoint/WPF