Javascript

Razor Pages, TypeScript and Knockout

calendar_today 16 July 2018 07:54

Javascript ASP.NET Core Razor Pages TypeScript

In this article, I look at the steps required to get TypeScript up and running in the context of a Razor Pages application. I discuss why you might want to do this, and I use Knockout for the purposes of demonstration. By the end of the article, I will have configured and used TypeScript to replicate part of the final code for the Single Page Application tutorial from learn.knockout.com.

ASP.NET 5: Managing Client-side Dependencies with NPM, Bower and Gulp

calendar_today 13 August 2015 21:05

Javascript ASP.NET MVC ASP.NET 5

This is the second in a series of articles that explores what's new in ASP.NET 5 by starting with the Visual Studio 2015 Empty site template and progressively adding files to emulate the Web Application template contents and structure. While not actually part of the ASP.NET 5 framework, this article explores the recommended tools for managing client-side dependencies: NPM, Bower and Gulp. These tools are very popular among front-end developers working with other frameworks and now that they have been integrated as first class citizens in Visual Studio 2015, their use is encouraged among .NET developers. The series of articles has been developed using Visual Studio 2015 and ASP.NET 5 Beta 6. It will be kept updated along with newer releases.

Implementing Google's EU End User Consent Policy

calendar_today 29 July 2015 21:56

Javascript HTML CSS jQuery

The European Union introduced laws some while ago requiring web sites to obtain consent from EU visitors to allow the use of cookies. Most larger corporate sites have implemented a policy for obtaining consent - or an "implied consent" solution, but countless smaller sites and blogs like mine have not bothered. That's about to change for a number of us who are Google Adsense publishers (we carry Google adverts on our sites) because Google has introduced a new EU user consent policy which must be followed by those of us who use products like Google Adsense (and who want to continue using them). This article is a quick overview of what the policy is about, and how I implemented a quick and effective solution.

What ASP.NET Can And Cannot Do

calendar_today 23 November 2009 22:26

Javascript General ASP.NET 3.5

If you are new to web development and choose ASP.NET Web Forms as your starting point, you may be forgiven for not understanding how ASP.NET works, and what its role is. This article covers the basics which should help you discover your limits.

jQuery Star Rating with ASP.NET MVC

calendar_today 08 September 2009 13:40

AJAX Javascript jQuery ASP.NET MVC

There are a number of jQuery star rating plugins to choose from. All have their pros and cons. For this site, I decided to implement the one from FyneWorks because it allows for split stars. Here's how I did it.

Build your own Whois Lookup with ASP.NET and jQuery

calendar_today 14 April 2009 22:39

AJAX Javascript ASP.NET 3.5 jQuery

IP addresses can reveal a lot about your web visitors. For an ecommerce site, the owner or registrant of the visitor's IP address can be very useful information. You could paste each visitor IP address into one of the many free IP Lookup sites available, but that can be time-consuming and tedious. Or you could build your own lookup. This article shows how this can be done pretty quickly.

Lazy Loading jQuery Tabs with ASP.NET

calendar_today 02 March 2009 07:30

AJAX Javascript ASP.NET 3.5 jQuery

This article looks at efficient use of jQuery tabs when displaying data. Specifically, it covers how to lazy-load data, so that it is only accessed and displayed if the tab is clicked.

Persisting the position of jQuery Draggables in ASP.NET

calendar_today 04 February 2009 22:29

AJAX Javascript ASP.NET 3.5 jQuery

It was bound to happen - you knock up an article on jQuery draggables one day, and the next, someone like Jim ;-) comes along and asks about persisting the position of the dragged item across Postbacks, or even sessions. I suppose it's my fault - I mentioned using draggables in a previous life in the context of saving the position, so it's only fair I share how that's done.

Experimenting with jQuery Draggables and ASP.NET

calendar_today 01 February 2009 08:12

Javascript ASP.NET 3.5 jQuery

One of the keystones of modern AJAX-enabled web sites is Drag and Drop. This article looks at the current state of Draggables that form part of the jQuery UI Library.

Preventing duplicate User Names with ASP.NET and jQuery

calendar_today 24 January 2009 18:18

AJAX Javascript ASP.NET 3.5 jQuery

It's a common problem: you have a registration form, but you want to prevent user names or other values from being used more than once. You need a user-friendly way to prevent duplicate values being submitted. This is where the simplicity of jQuery excels.

Ajax with Classic ASP using jQuery

calendar_today 17 January 2009 23:13

Classic ASP VBScript AJAX Javascript jQuery

My simple article on Ajax with Classic ASP is one of the most popular on this site. So I thought it's about time I updated it to show how to use jQuery to Ajaxify a Classic ASP page. Since I did that, the jQuery version became even more popular but needed to be brought up to date. This latest version uses a couple of suggestions that have been provided by commentors to improve the code. I have also added a download which contains all the code needed to run the samples.

Cascading DropDownLists with jQuery and ASP.NET

calendar_today 13 January 2009 08:47

AJAX Javascript ASP.NET 3.5 jQuery

Cascading DropDownLists or dependent dropdowns are the signature dish for AJAX applications. I spent quite a while fiddling to try to get some to work, before stumbling across a life-saving jQuery plugin that makes working with DropDownLists on the client-side a breeze. This article shows how it all works, and makes use of the WebService I introduced in my previous jQuery article.

Handling JSON Arrays returned from ASP.NET Web Services with jQuery

calendar_today 10 January 2009 09:09

AJAX Javascript ASP.NET 3.5 jQuery ASP.NET Web Forms

There appear to be many articles showing how to use jQuery with ASP.NET Web Services around, but the vast majority of them illustrate the use of PageMethods that return a single value - typically "Hello World!" or the current date and time. Not much use in the real world, where you may more often need to call a service that returns a collection of complex objects. Here are a couple of examples that look at playing with more than just simple values.

Upload and Crop Images with jQuery, JCrop and ASP.NET

calendar_today 05 January 2009 13:54

C# AJAX Javascript ASP.NET 3.5 jQuery

I got given jQuery In Action for Christmas. By nature, I'm kind of a late adopter, and I'm already regretting this fact. jQuery has been around for some time, and I wished I had looked at it sooner. It's a fantastic library that really simplifies Javascript development, and is already attracting a goodly number of plug-ins. JCrop is one such, and while it hasn't yet reached version 1.0, it is remarkably easy to use as a web based image cropper. Here's how to put jQuery, JCrop and a FileUpload control together to allow users to upload images and crop them.

A DataBound Javascript News Ticker for ASP.NET

calendar_today 25 December 2008 14:18

Javascript ASP.NET 3.5

It's funny how requirements come along like buses in the ASP.NET forums - you suddenly get the same thing asked for by two or more people in quick succession. Recently, a couple of people asked for help creating a Javascript ticker, like the one at the top of the BBC News site, which displays a selected number of headlines drawn from a database. I had adapted the code from the BBC site to create a similar widget that displayed the most recent threads in a message board on an old Classic ASP site some time ago. It's about time I dusted it off and updated it for use in an ASP.NET application.

ViewState, form fields, labels and Javascript

calendar_today 25 August 2007 12:34

ASP.NET 2.0 Javascript ASP.NET Web Forms

An interesting question came up on the ASP.NET forums asking why a TextBox which has its value changed by client-side Javascript persists those changes across postbacks, while a Label does not. And in a nut shell, this question covered two of the biggest causes of confusion among newcomers to ASP.NET: the difference between ViewState and IPostBackDataHandler; and the difference between client-side operations and server-side operations.

Javascript functions for form fields

calendar_today 12 May 2007 22:54

Javascript

A number of useful functions for accessing various properties and values of form fields.

ASP.NET and Ajax - using XmlHttpRequest

calendar_today 08 May 2007 17:32

ASP.NET 2.0 AJAX Javascript

If you are not interested in using the ASP.NET AJAX library offered for ASP.NET, but would like to feature small amounts of AJAX functionality on your pages, you can do this easily with some javascript and a receptive page.

AJAX and Classic ASP

calendar_today 06 May 2007 23:29

Classic ASP VBScript AJAX Javascript

Using the xmlhttpserver object in javascript to request an asp page containing script to output text.

How to highlight a GridView's row on hover

calendar_today 06 May 2007 20:50

C# ASP.NET 2.0 Javascript

As the user hovers over each row, it becomes highlighted, with the help of a small amount of javascript.

How to make an ASP.NET Table row highlight and become clickable

calendar_today 06 May 2007 20:38

C# ASP.NET 2.0 Javascript HTML

For those people who like to output their data to an asp:Table, highlighting the entire row and making it clickable can make it obvious to the user that some action is expected from them. This emulates the behaviour that can be found in some desktop applications. All that's needed for this is a bit of javascript, and the use of AddAttributes() for the table rows.

Javascript 24 hour clock

calendar_today 01 May 2007 22:54

Javascript

A snippet for a javascript clock showing time in 24 hours with seconds