Archive

Author Archive

Silverlight 3 Validation and Dataform control

May 28th, 2009 Jeffrey Tummers No comments

This post is about the session calledWhat’s new in Silverlight 3 given by Mike Taulty.

Silverlight 3 has a new way for validating data. The validation rules can be set in a number of different ways:

  • Throwing an exception
  • Adding specific attributes to the classes properties

I specifically like the way the business rules can be applied to an object. Some samples of specifying the validation are shown below.

class Person
{
[Required(ErrorMessage = “The name of the person is required”)]
public string Name { get; set; }

[Range(18, 65, ErrorMessage = ”The person must be between 18 and 65 years old”)]
[DefaultValue(20)]
public int Age { get; set; }
}

More validation attributes are available at MSDN

The nice thing about the new version of Silverlight 3 is that the default input controls can handle these validation errors and show them to the user, this is very similar to the way we know validation controls in ASP.NET. The way in which these messages are shown is fully customizable through themes.

sl3_dataform

The screenshot above shows an example of the new Dataform which is also available in Silverlight 3. It also gives you an example of the standard way a user is informed about errors.

With the new Dataform control it is possible to automatically render the CRUD GUI for an object or list of objects.

By implementing the IEditableObject interface for an object, the following events can be handled within the class: BeginEdit, CancelEdit and EndEdit

For more information about the Dataform control see the following blog post of Mike Taulty, another post by Mike Taulty is about data validation

Categories: DevDays09 Tags: , ,

New features in ASP.NET AJAX 4.0

May 28th, 2009 Jeffrey Tummers No comments

This post is about the session called ASP.NET AJAX 4.0 given by Fritz Onion

A preview of the new version of ASP.NET AJAX is avaible on codeplex since the 28th of May. And it can be used within Visual Studio 2008.

This version mainly focuses on new client side features, some of these are be discussed below.

Live data binding
Gives the developer an easy way to bind multiple controls to a single datasource, if a value changes all controls are automatically updated client side.

Observer pattern
This provides observer functionality to ordinary JavaScript objects, when a change occurs for an observed object a notification is caused, which can be handled accordingly

Client templates
In an asp.net web application a list of data can be shown using a Repeater control, which is server sided. In 4.0 this can be done client sided as well. The way to define this is by using a XHTML compliant template, as shown below.

	<table id="resultTable" class="sys-template">
		<tr>
			<td>{{Name}}</td>
			<td>{{Id}}</td>
		</tr>
	</table>
	

This type of databinding notation is similar to Silverlight/WPF.

Inclusion of and support for jQuery library
The development team at Microsoft has acknowledged the use of the jQuery library and it will be included in the next release

Web service invocation
It is now easy to invoke a method of a WCF service. A downside is that the service must support JSON serialization and AJAX proxy generation, by default this is possible with WCF services.

Some nice new features the development team is working on are:

  • Client sided sorting, pagination and filtering
  • Sending changes to the server
  • AJAX Control Toolkit will get rolled into the core release (previously this was a separate download)

Categories: DevDays09 Tags: , , ,

QNH at Microsoft DevDays09

May 25th, 2009 Jeffrey Tummers No comments

On the 28st and 29nd of May 2009 (upcomming thursday and friday), Laurens ‘t Hardt and me (Jeffrey Tummers) are going to the Microsoft DevDays ’09.

QNH @ DevDay09

The trip is sponsored by our employee QNH, on the days of the event we will be posting several blogposts on this site. Be sure to check the new posts here.

Categories: DevDays09 Tags: ,