-
The simplest way is to have a target addressable text range (any html tag with and id or name set) that we can reference and write into.
-
For the most part this method, when added to our application object or page class, makes it so we can ‘inject’ ECMA script to our hearts content. This includes code that is executed upon evaluation so we don’t have to call out again to execute some function. There are limits to what you can do (i....
-
This article explains how to make an ASP.NET Editable Nested GridView. Here I am going to explain how to provide all the features of Edit/Add/Delete/Update/Page/Sort of a GridView, and not only one GridView, but I am going to explain how to extend these features to even nested grids (GridView inside...
-
Code to upload Audio/Image Files in Sql Server
-
Caching can save you loads of time on the processing side of things, so much so that ASP.NET is rich with caching features - output caching for a specific duration is simple to use. I will use output caching that will only force the render of new markup if the value of CourseId differs from one prev...
-
An incredibly common task is that of retrieving the value of a specific key passed via the URL. The appealing format of URLs is that they can be composed rather elegantly and thus are in many scenarios a good way to go for passing data between pages. To access the value of a key, simply use the Requ...
-
One of the concepts around ASP.NET that seems a little strange at first sight is that of postback, put simply when you check for postback you are essentially asking if a control on the page has invoked communication with the server after the initial response. This doesn't apply to XMLHttpRequest's t...
-
This is a particularly cool way to get the profile data of a user – using the profile service exposed in ASP.NET AJAX. The profile properties can be accessed as JS based properties so the programming model is pretty consistent across VB.NET, C# and JS.
-
I have seen this question asked numerous times on various forums, and while XML is larger in size than JSON and requires parsing it may still be favourable to use in certain scenarios. ASP.NET AJAX actually allows you to specify the ResponseFormat of a web services’ method – selecting the Xml option...
-
One of the scenarios you may encounter several times is when you have several UpdatePanel controls on a page, but having a generic loading animation or visual cue doesn’t really transfer to the user the correct message. For this particular scenario you can actually associate an UpdateProgress contro...
-
One of my personal favourite new features in C# 3.0 is the ability to concisely initialize the items of a collection using collection initializers. One thing to note is that every item of the type of the collection you define within the curly braces calls that collections Add method.
You can see th...
-
With the advent and somewhat mainstream adoption of AJAX the importance of visual cues became essential. One of the things woven into the ASP.NET AJAX server controls is the UpdateProgress control that makes it very easy to provide visual cues when asynchronous operations are occurring. The followin...
-
A powerful tool in ASP.NET AJAX development is being able to trace key events (or events you consider key in your applications behaviour) and dumping objects and/or annotations to a standard text box. Microsoft AJAX library actually has the facilities to do this, you need only have a textarea with a...
-
Code to Transfer/upload File to FTP Server
-
C# 3.0 offers a new syntax for instantiating an object as well as setting a bunch of initial properties and values on it. This works for regular types as well as lists and dictionaries.
-
This snippet shows the evolution of delegates in C# from 1.x to the current 3.0 version.
In C# 1.x, we didn't have anonymous delegates, so you had to 1.) define the delegate, 2.) create a method that implements the delegate and 3.) create and use the delegate
In C# 2.x, you could use anonymous...
-
There may be some scenarios where you need to clean something up upon the unloading of the page. The unload event is raised when the user browses to another URL. Just like the init event you have to explicitly register the event subscription.
-
The init event is raised after all scripts have loaded BUT befor any objects have been created. Unlike the pageLoad function that is implicitly wired to the load event you have to explicitly wire the init event up.
-
Just like there are several events you can hook into on the server page event lifecycle there are also a few on the client now that MS AJAX exposes - one of them is pageLoad. You don't need to explicitly subscribe to the event, rather the subscription is implicit when you define a function named pag...
-
The below is an example of calling a traditional ASP.NET web service (ASMX) using ASP.NET AJAX and the MS AJAX Library.
-
Possibly one of the best things about ASP.NET AJAX is that it takes care of the plumbing when you want to call a web service, typically it will be an ASMX service but it is just as easy to call a WCF service (.svc). The below example calls a service method GetPeople that returns a List<string>...
-
A common task in a HTML page that has a lot of interaction based JavaScript is to find a control within the DOM quickly. One of the helper functions in the MS AJAX library provides a quick and concise shorthand method for locating a control by ID - $get().
-
The following is a very simple example of binding a DDL's text and value properties to an active data source.
-
Sometimes you will want to be a little creative in how you show data in a GridView, for this scenario you are free to create a template and use the binding syntax to bind values to a control. The following snippet is very simple – it binds the ContactName to a Label control – the addition of more vi...
-
By default when you hook up the GridView to a data source control the header text of each column is that of the respective data (e.g. it may be the name of the property in the database table etc). Most of the time you will want to modify this, you can do so by explicitly specifying the columns of th...