ASP.Net Tips Archives - All Things DotNetAll Things DotNet
  • Subscribe to this RSS feed
  • Receive updates as soon as they are posted.

ASP.Net Tips Category

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.

September 8 , 2015 | | In: ASP.Net, ASP.Net Tips

Working With QueryStrings

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 […]

August 19 , 2015 | | In: ASP.Net, ASP.Net Tips, C#

Get Local Computer Name from Website on Server

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. […]

January 6 , 2015 | | In: ASP.Net Tips, MVC

Prefill Textboxes with Decimal Format

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 […]

September 12 , 2014 | | In: ASP.Net, ASP.Net Tips, C#, DotNet General

Calculating Current Fiscal Year

If you are in a company in which the Fiscal Year does not start January 1st, it might become necessary in your code, to figure out what the actual Fiscal Year is at any point during the year. The following is a method (in C#) which returns a string based on the fact that the […]

I wanted to change the .Net Framework of my C# Windows app. Every site I went to to find out where to change said to right click on the project to get the properties page. Then, I would be able to change it in the ‘Target Framework’ dropdown. I never could see that dropdown.

October 12 , 2013 | | In: ASP.Net, ASP.Net Tips, JQuery, MVC

Javascript Library Not Loading

Have you ever had a script tag in your code like this?: <script type=”text/javascript” src=”@Url.Content(“~/Scripts/myJavascriptLibrary.js”)” /> What’s more, did you find that it was not actually loading when the page ran?

September 16 , 2013 | | In: ASP.Net, ASP.Net Tips

Error: Operation must use an updateable query

This problem has been around since Classic ASP and is still there, in ASP.Net, when using an Access Database. The problem shows up when trying to update the database, but there is an easy fix.

September 2 , 2013 | | In: ASP.Net Tips, MVC, MVC3

Customized Required Message in MVC

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.

July 27 , 2013 | | In: ASP.Net, ASP.Net Tips, C#

IIF Equivalent in C#

For those of us who came from a VB background, we know how great the immediate if is (iif). To do this in C#, it’s not so straightforward it seems, at least at first, but it’s just as easy and useful. Here’s how it’s the framework is done in C#: yourBool ? “true” : “false”; […]

All Things DotNet Discussed – Winforms/ASP.Net/SharePoint/WPF

If you find this site helpful,
please donate to help keep it online and free

Code 'n' Sprox   DreamTemplate - Web Templates

Follow us on Twitter

Follow AllThingsDotNet on Twitter

Test - The Name: 6936