In this post I am showing how to implement Column Grouping in SIlverlight 3 DataGrid,

Before starting make sure you have SIlverlight3_Tools installed in your system, not SIlverlight 3 Beta, as there are lost of changes in Grouping of Columns from SIlverlight 3 Beta to Silverlight 3 RTW.

image

You can follow the few simple steps below to get the Grouping for your Silverlight 3 DataGrid.

Else you can also download the code demonstrated from here.

1. Create an Silverlight Application using you Visual Studio 2008 IDE, and add a hosting web application in the project.

2. Once you have done with this, you will get an two projects in your Solution, you need to code only in your silverlight project.

3. Now add a C# class file called Person.cs in your Silverlight Project. This class is used to provide some sample data to Silverlight DataGrid, you can change this to your other datasources like SQL, XML, etc.

I have added the following lines of code in Person.cs

   1: public class Person
   2:     {
   3:         public string FirstName { get; set; }
   4:         public string LastName { get; set; }
   5:         public string City { get; set; }
   6:         public string Country { get; set; }
   7:         public int Age { get; set; }
   8:  
   9:         public List<Person> GetPersons()
  10:         {
  11:             List<Person> persons = new List<Person>
  12:             {
  13:                 new Person
  14:                 { 
  15:                     Age=32, 
  16:                     City="Bangalore", 
  17:                     Country="India", 
  18:                     FirstName="Brij", 
  19:                     LastName="Mohan"
  20:                 },
  21:                 new Person
  22:                 { 
  23:                     Age=32, 
  24:                     City="Bangalore", 
  25:                     Country="India", 
  26:                     FirstName="Arun", 
  27:                     LastName="Dayal"
  28:                 },
  29:                 new Person
  30:                 { 
  31:                     Age=38, 
  32:                     City="Bangalore", 
  33:                     Country="India", 
  34:                     FirstName="Dave", 
  35:                     LastName="Marchant"
  36:                 },
  37:                 new Person
  38:                 { 
  39:                     Age=38,
  40:                     City="Northampton",
  41:                     Country="United Kingdom", 
  42:                     FirstName="Henryk", 
  43:                     LastName="S"
  44:                 },
  45:                 new Person
  46:                 { 
  47:                     Age=40, 
  48:                     City="Northampton", 
  49:                     Country="United Kingdom", 
  50:                     FirstName="Alton", 
  51:                     LastName="B"
  52:                 },
  53:                 new Person
  54:                 { 
  55:                     Age=28, 
  56:                     City="Birmingham",
  57:                     Country="United Kingdom",
  58:                     FirstName="Anup", 
  59:                     LastName="J"
  60:                 },
  61:                 new Person
  62:                 { 
  63:                     Age=27,
  64:                     City="Jamshedpur",
  65:                     Country="India", 
  66:                     FirstName="Sunita", 
  67:                     LastName="Mohan"
  68:                 },
  69:                 new Person
  70:                 { 
  71:                     Age=2, 
  72:                     City="Bangalore", 
  73:                     Country="India", 
  74:                     FirstName="Shristi", 
  75:                     LastName="Dayal"
  76:                 }
  77:             };
  78:  
  79:             return persons;
  80:         }
  81:     }

4. Now since my data is ready, I will add the DataGrid control in my XAML page, to make the presentation more attractive, I have added few more lines of code.

5. I have also added a ComboBox Control to Select the Grouping Columns name.

My XAML code will look something like this below.

   1: <UserControl 
   2:     xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  
   3:     x:Class="Silverlight3DataGrid.MainPage"
   4:     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
   5:     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   6:     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
   7:              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
   8:     mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
   9:     <Grid x:Name="LayoutRoot">
  10:         <Grid.RowDefinitions>
  11:             <RowDefinition Height="0.154*"/>
  12:             <RowDefinition Height="0.483*"/>
  13:             <RowDefinition Height="0.362*"/>
  14:         </Grid.RowDefinitions>
  15:  
  16:         <StackPanel Orientation="Horizontal">
  17:             <TextBlock Text="Select Sort Criteria" 
  18:                        VerticalAlignment="Center" />
  19:  
  20:             <TextBlock Text="    " />
  21:             
  22:             <ComboBox Grid.Row="0" 
  23:                       HorizontalAlignment="Left" 
  24:                       Width="200" 
  25:                       Height="30" x:Name="SortCombo" 
  26:                       SelectionChanged="SortCombo_SelectionChanged">
  27:                 
  28:                 <ComboBoxItem Content="Country" ></ComboBoxItem>
  29:                 <ComboBoxItem Content="City" ></ComboBoxItem>
  30:                 <ComboBoxItem Content="Age" ></ComboBoxItem>
  31:             </ComboBox>
  32:         </StackPanel>
  33:         
  34:         <data:DataGrid x:Name="PersonGrid" Grid.Row="1"></data:DataGrid>
  35:  
  36:     </Grid>
  37: </UserControl>

6. Now as my Data and Presentation is ready, its time for me to write some lines of code to Retrieve my sample data, group them into columns and then Bind it to the Grid.

Please find below the rest of the Code which demonstrates how I have Grouped the Columns using PagedCollectionView and PropertyGroupDescription.

   1: public partial class MainPage : UserControl
   2:     {
   3:         PagedCollectionView collection;
   4:  
   5:         public MainPage()
   6:         {
   7:             InitializeComponent();
   8:             BindGrid();
   9:         }
  10:  
  11:         private void BindGrid()
  12:         {
  13:             Person person = new Person();
  14:             PersonGrid.ItemsSource = null;
  15:             List<Person> persons = person.GetPersons();
  16:             collection = new PagedCollectionView(persons);
  17:             collection.GroupDescriptions.Add(new 
  18:                 PropertyGroupDescription("Country"));
  19:  
  20:             PersonGrid.ItemsSource = collection;
  21:         }
  22:  
  23:         private void SortCombo_SelectionChanged(object sender, 
  24:             SelectionChangedEventArgs e)
  25:         {
  26:             ComboBoxItem person = SortCombo.SelectedItem as ComboBoxItem;
  27:             collection.GroupDescriptions.Clear();
  28:             collection.GroupDescriptions.Add(new 
  29:                 PropertyGroupDescription(person.Content.ToString()));
  30:  
  31:             PersonGrid.ItemsSource = null;
  32:             PersonGrid.ItemsSource = collection;
  33:         }
  34:     }

Yes its that simple, and its done. I know I have not given much description here, because nothing much to explain here. In the code above I am loading the Grid with my sample data coming from my Person class and default grouping the Person with Country.

Later on SortCombo_SelectionChanged, I am dynamically fetching the Selected column names from the ComboBox and Sorting on that.

Once you will run this application the screen will look something like this as given below.

Grouped by Country

image

Grouped by City

 image 

 Grouped by Age

image

 

You can group according to your requirement, like Grouping Active and Deleted items, etc.

 

You can also download the sample code from here.

 

Cheers

~Brij

Hi All, here is the link for the great library of cheat sheets, I assure you that after looking into this collection you will be amazed....these Cheat Sheets are...

  • Written by bestselling authors and leading experts
  • Reliable information on major developer topics
  • Filled with useful tips and source code examples
  • PDF looks great on-screen or printed from your printer

To name a few...

  • Design Patterns
  • Silverlight 2, I am eagerly waiting for Silverlight 3, I know its too early...
  • C#
  • Core .NET
  • Core ASP.NET
  • Scrum
  • Windows PowerShell

These are just few of my interest, but you can always register and logon to download lot more of your interest too...from the link below.

http://refcardz.dzone.com/

A common problem when developing Silverlight applications is how to share classes and in particular (Entity Framework) entities which are compiled for the full .NET framework in a Silverlight application. Silverlight is a browser plugin and a platform independent subset of the full .NET framework. Therefore Visual Studio does not allow referencing .NET assemblies from your Silverlight application.

Fortunately there is a very simple technique to share and reuse source code. Full details of which you can find in the link below

http://www.scip.be/index.php?Page=ArticlesNET28&Lang=EN

In this article Stefan Cruysberghs demonstrated this technique with several real world examples and I will give you some handy tips.

This linked has helped me, as I have SOA, where WCF Services, DataContracts, ServiceContracts are shared between my ASP.NET , WPF and Silverlight application.

As currently I am working on Migration from Silverlight 2.0 to Silverlight 3, so I thought to share or bookmark few of the important links which I am going through.

Find below the links

http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx

Silverlight 3 Released! What is new/changed?

The following list encompasses all changes made between the Silverlight Toolkit March 2009 release and the Silverlight Toolkit July 2009 release.

Silverlight Toolkit July 2009 Changes

The following list encompasses all change made between the Silverlight Toolkit December 2008 release and the Silverlight Toolkit March 2009 release.

Silverlight Toolkit March 2009 change list.

In the process of upgrade there are few more challenges I am going to face

Upgrade of my WCF Services to implement Silverlight 3 Validation controls, as my DataContract is residing in Service Layer, and I am using WSSF to generate the WCF DataContract, ServiceContract, etc. As all the DataCOntracts are AutoGenerated so implementing the Validation in Silverlight will be bit tricky.

Since I am still in the process of upgrade, so if you too have some good links which will help me to upgrade my Services as I mentioned above then please do share here.

Thanks

Brij Mohan

1 Layouts Presentation.zip

2 Introducing_Silverlight_2.zip

3 Introductionto Silverlight 3.zip

4 Silverlight Control Lifecycle.zip

These are the Slides of the Silverlight Presentation which I had given on 17th July 2009, other useful links where you can download the examples and Installers are given below.

WHAT’S NEW IN SILVERLIGHT 3?

Download Microsoft® Silverlight™ 3 Tools for Visual Studio 2008 SP1

This download will install the following:

  • Silverlight 3 developer runtime
  • Silverlight 3 software development kit
  • KB967143 for Visual Studio 2008 SP1
    and/or
    KB967144 for Visual Web Developer 2008 Express with SP1
  • Silverlight 3 Tools for Visual Studio 2008 SP1
    and/or
    Silverlight 3 Tools for Visual Web Developer 2008 Express with SP1

The Official Site of Silverlight | Microsoft Silverlight

Microsoft Expression Blend 3

Silverlight Community

Microsoft Silverlight 3 Offline Documentation

And for all other things,

http://www.silverlight.net

And for those who are mostly involved in Silverlight Designing

http://www.kirupa.com/blend_silverlight/index.htm

http://expression.microsoft.com/en-us/cc184874.aspx

There are few basic concepts which I have used in my Presentation like Automatic Properties, Object Initializers, LINQ, etc you can find almost all these in Scott’s Blog

 

Thanks

~Brij

In this post I am going to show you the basic example of Creating the Page with DataBound Silverlight 2.0 DataGrid, and also I will show you how to format the Data Using IValueConverter in DataGrid dynamically.

Create a new project and Select Silverlight Application.

image

Name your application and select Ok, select the options as given in the screen below.

image

Once you select Ok, your solution should look something similar to the one given in the screen below.

clip_image002[9]

Select the DataGrid from the ToolBox and Drag and Drop it on you page, you can also go and Add the DataGrid manually in you XAML code, but if you are doing so then you may also have to add the reference to the assembly and define the custom tag to use for your DataGrid. This is done automatically when you do the Drag and Drop of the control.

clip_image002[11]

Now if you are aware of the Silverlight Layouts then you can format your page and position your DataGrid in more better way as given in the Code below, in the code below I am defining the Rows and Adding the Header for the Page and in the next row I am placing my DataGrid.

Page.xaml

   1: <UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  x:Class="DataGridDemo.Page"
   2:     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
   3:     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
   4:     xmlns:conv="clr-namespace:DataGridDemo"
   5:     Width="600" Height="300">
   6:     
   7:     <Grid x:Name="LayoutRoot" Background="White" HorizontalAlignment="Center">
   8:         <Grid.RowDefinitions>
   9:             <RowDefinition Height="50"/>
  10:             <RowDefinition Height="*"/>
  11:         </Grid.RowDefinitions>
  12:         <TextBlock Text="List of Player and their details" FontSize="20" Grid.Row="0"></TextBlock>
  13:         <data:DataGrid x:Name="GridPlayer" Grid.Row="1">
  14:             
  15:         </data:DataGrid>
  16:     </Grid>
  17: </UserControl>

 

Now my next task is to create the sample Data to bind the DataGrid, if you already have some data source then you can your that only, or you can use the one as given in the code below. I am creating the Player.cs and PlayerCollection.cs class, which will have to List of Players. Then in GetDemoData in Player.cs I am populating the demo data.

Player.cs

   1: using System;
   2: using System.Net;
   3: using System.Windows;
   4: using System.Windows.Controls;
   5: using System.Windows.Documents;
   6: using System.Windows.Ink;
   7: using System.Windows.Input;
   8: using System.Windows.Media;
   9: using System.Windows.Media.Animation;
  10: using System.Windows.Shapes;
  11:  
  12: namespace DataGridDemo
  13: {
  14:     public class Player
  15:     {
  16:         public string FirstName { get; set; }
  17:         public string LastName { get; set; }
  18:         public string SkillSet { get; set; }
  19:         public DateTime DOB { get; set; }
  20:  
  21:         public static PlayerCollection GetDemoPlayers()
  22:         {
  23:             PlayerCollection players = new PlayerCollection 
  24:             {
  25:                 new Player 
  26:                 { 
  27:                     FirstName = "Brij", 
  28:                     LastName = "Mohan", 
  29:                     SkillSet = "Rugby",
  30:                     DOB=Convert.ToDateTime("08/31/1977")
  31:                 }, 
  32:                 new Player
  33:                 {
  34:                     FirstName="David", 
  35:                     LastName="Osborne", 
  36:                     SkillSet="Cricket",
  37:                     DOB=Convert.ToDateTime("01/11/1976")
  38:                 },
  39:                 new Player
  40:                 {
  41:                     FirstName="Henry", 
  42:                     LastName="Smith", 
  43:                     SkillSet="Chess",
  44:                     DOB=Convert.ToDateTime("11/10/1981")
  45:                 }
  46:             };
  47:  
  48:             return players;
  49:         }
  50:     }
  51:  
  52: }

PlayerCollection.cs

   1: using System;
   2: using System.Net;
   3: using System.Windows;
   4: using System.Windows.Controls;
   5: using System.Windows.Documents;
   6: using System.Windows.Ink;
   7: using System.Windows.Input;
   8: using System.Windows.Media;
   9: using System.Windows.Media.Animation;
  10: using System.Windows.Shapes;
  11: using System.Collections.Generic;
  12:  
  13: namespace DataGridDemo
  14: {
  15:     public class PlayerCollection: List<Player>
  16:     {
  17:  
  18:     }
  19: }

 

Now I have all the data ready to bind the Silverlight DataGrid, so I will modify my Page.xaml.cs as the one given below. In the code below I am just binding the Silverlight DataGrid using the ItemSource property of the DataGrid.

Page.xaml.cs

   1: using System;
   2: using System.Collections.Generic;
   3: using System.Linq;
   4: using System.Net;
   5: using System.Windows;
   6: using System.Windows.Controls;
   7: using System.Windows.Documents;
   8: using System.Windows.Input;
   9: using System.Windows.Media;
  10: using System.Windows.Media.Animation;
  11: using System.Windows.Shapes;
  12:  
  13: namespace DataGridDemo
  14: {
  15:     public partial class Page : UserControl
  16:     {
  17:         public Page()
  18:         {
  19:             InitializeComponent();
  20:             BindDataGrid();
  21:         }
  22:         private void BindDataGrid()
  23:         { 
  24:             GridPlayer.ItemsSource = Player.GetDemoPlayers();
  25:         }
  26:     }
  27: }

Now you can run the application and can see the output.

image

Now one thing you can notice in the screen below, i.e the DOB column, the dates are not coming what we are expecting and also the column name is also not very Readable, so we need to define the ColumnTemplates and add few more codes to customize our data and have more control on the Desing.

image

To format the DOB column, first I have Created the class, I named it here in my project as DateConverter.cs, and also added the reference to System.Windows.Data

Now all we need to derive the Class from IValueConverter Interface and implement the interface, like the one given below

 

DateConverter.cs

   1: using System;
   2: using System.Net;
   3: using System.Windows;
   4: using System.Windows.Controls;
   5: using System.Windows.Documents;
   6: using System.Windows.Ink;
   7: using System.Windows.Input;
   8: using System.Windows.Media;
   9: using System.Windows.Media.Animation;
  10: using System.Windows.Shapes;
  11: using System.Windows.Data;
  12: using System.Globalization;
  13:  
  14: namespace DataGridDemo
  15: {
  16:     public class DateConverter : IValueConverter
  17:     {
  18:  
  19:         #region IValueConverter Members
  20:  
  21:         /// <summary>
  22:         /// Converts values on their way to the UI for display
  23:         /// </summary>
  24:         /// <param name="value">The value to be formatted</param>
  25:         /// <param name="targetType">The target type of the conversion</param>
  26:         /// <param name="parameter">A format string to be used in the 
  27:         /// formatting of the value</param>
  28:         /// <param name="culture">The culture to use for formatting</param>
  29:         /// <returns>The converted or formatted object</returns>
  30:         public object Convert(object value, Type targetType, object parameter, 
  31:             System.Globalization.CultureInfo culture)
  32:         {
  33:             if (parameter != null)
  34:             {
  35:                 string formatterString = parameter.ToString();
  36:                 if (!string.IsNullOrEmpty(formatterString))
  37:                 {
  38:                     return string.Format(culture, formatterString, value);
  39:                 }
  40:             }
  41:             return value.ToString();
  42:         }
  43:  
  44:         /// <summary>
  45:         /// Converts values on their way back from the UI to the backend.
  46:         /// </summary>
  47:         /// <param name="value">The value to be formatted</param>
  48:         /// <param name="targetType">The target type of the conversion</param>
  49:         /// <param name="parameter">A format string to be used in the 
  50:         /// formatting of the value</param>
  51:         /// <param name="culture">The culture to use for formatting</param>
  52:         /// <returns>The converted or formatted object</returns>
  53:         public object ConvertBack(object value, Type targetType, object parameter, 
  54:             System.Globalization.CultureInfo culture)
  55:         {
  56:             return System.Convert.ToDateTime(value, CultureInfo.CurrentUICulture);
  57:         }
  58:  
  59:         #endregion
  60:     }
  61: }

Next you need to Use template and set the following property in your DataGrid

   1: AutoGenerateColumns="False"

Run the application now, you will not see anything in your default.aspx, because we have set the AutoGenerateColumns as False, so we have to write few bits of code to define our own Column Template for the DataGrid, I personally would prefer using the DataGrid.Column Template, as this gives me more control over the data and the design.

Add the following code inside your DataGrid

   1: <data:DataGrid.Columns>
   2:                 <!--First Name-->
   3:                 <data:DataGridTemplateColumn Header="First Name">
   4:                     <data:DataGridTemplateColumn.CellTemplate>
   5:                         <DataTemplate>
   6:                             <TextBlock Text="{Binding FirstName, Mode=TwoWay}"/>
   7:                         </DataTemplate>
   8:                     </data:DataGridTemplateColumn.CellTemplate>
   9:                 </data:DataGridTemplateColumn>
  10:                 <!--End First Name-->
  11:                 <!--Last Name-->
  12:                 <data:DataGridTemplateColumn Header="Last Name">
  13:                     <data:DataGridTemplateColumn.CellTemplate>
  14:                         <DataTemplate>
  15:                             <TextBlock Text="{Binding LastName, Mode=TwoWay}"/>
  16:                         </DataTemplate>
  17:                     </data:DataGridTemplateColumn.CellTemplate>
  18:                 </data:DataGridTemplateColumn>
  19:                 <!--End Last Name-->
  20:                 <!--SkillSet-->
  21:                 <data:DataGridTemplateColumn Header="Skill Set">
  22:                     <data:DataGridTemplateColumn.CellTemplate>
  23:                         <DataTemplate>
  24:                             <TextBlock Text="{Binding SkillSet, Mode=TwoWay}"/>
  25:                         </DataTemplate>
  26:                     </data:DataGridTemplateColumn.CellTemplate>
  27:                 </data:DataGridTemplateColumn>
  28:                 <!--End SkillSet-->
  29:                 <!--DOB-->
  30:                 <data:DataGridTemplateColumn Header="Date of Birth">
  31:                     <data:DataGridTemplateColumn.CellTemplate>
  32:                         <DataTemplate>
  33:                             <TextBlock Text="{Binding DOB, Mode=TwoWay}"/>
  34:                         </DataTemplate>
  35:                     </data:DataGridTemplateColumn.CellTemplate>
  36:                 </data:DataGridTemplateColumn>
  37:                 <!--End DOB-->
  38:             </data:DataGrid.Columns>

Run the application.

You can see the same output, except the Header text of DOB, you had when you had the AutoGenerateColumns=True,

Now I am going to show how you can use your DateConverter.cs class to format your DateTime, to do so

First you need to import the class which we are going to use to format the DateTime, and also we have to define the tag, this can be done by adding the following code in your UserControl Tag

   1: xmlns:conv="clr-namespace:DataGridDemo"

 

The completed UserControl Tag will look something like this as given below

   1: <UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  x:Class="DataGridDemo.Page"
   2:     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
   3:     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
   4:     xmlns:conv="clr-namespace:DataGridDemo"
   5:     Width="600" Height="300">

Now add the following code in your XAML code just above your LayoutRoot Grid Layout

   1: <UserControl.Resources>
   2:         <conv:DateConverter x:Key="FormatConverter" />
   3: </UserControl.Resources>

Now you have all the required classes and tag defined for your DateConverter.cs, we have to specify the Column in which we are going to apply this format, as currently we are formatting the DateTime, so we have to apply this for our DOB column, by modifying the following code, as given below

 

   1: <TextBlock Text="{Binding DOB, Mode=TwoWay, Converter={StaticResource FormatConverter}, 
   2: ConverterParameter=\{0:D\}}"/>

 

Now run your application you will get the following output

Final Screen

In the screen above you can notice the Date of Birth date format,

So these are the very basic example I had given here to use the Silverlight 2.0 DataGrid and format the data in the Silverlight 2.0 DataGrid.

You can be more creative and can design the whole new look itself and can get the more control on the data using Silverlight 2.0 DataGrid control.

You can download the source code of the complete solution from here

For those who are facing the problems of intellisense not working for XAML files, please follow the steps below to fix that.

1. Uninstall the Silverlight using the control panel snap in as given in the screenshot below.

clip_image001

2. Download and Install the Silverlight Tools by clicking on the following location

http://www.microsoft.com/downloads/details.aspx?FamilyID=c22d6a7b-546f-4407-8ef6-d60c8ee221ed&displaylang=en

3. If you have installed Silverlight DataGrid 2008 Update, then re-installing the Silverlight Tools will delete all your files from your C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client , so you will loose the DataGrid December 2008 update. So you will need to fix this again, details of which you can find in the below given link.

http://silverlight.net/forums/p/59990/176470.aspx

FYI: This usually happens when Silverlight Toolkit is installed before the Visual Studio 2008 IDE, Usually when we install Silverlight Toolkit, it installs the patch for Visual Studio 2008 IDE which enables intellisense. But in absence of VS2008 IDE, Silverlight Toolkit skips this patch.

This patch for intellisense will get installed only when it detects VS2008 IDE already installed in our Systems.

I hope this helps.

Cheers

~Brij

These are few things which currently I am working on and some technologies which I want to learn in coming months to master these technologies I need your help,

So please post some good tutorials and articles on any of the following topics, if you have any.

1. Silverlight 2.0/3.0

2. Microsoft .NET 2008/2010 and Framework 3.5 SP1/4.0

3. Model View Presenter and Model View Controller Architecture

4. WCF, WSSF incuding Creating custom templates for Implementation Technologies, etc

5. Visual Studio SDK

6. Visual Studio Database Projects (SQl Server 2008 and SQL Server 2005)

7. SQL Server 2008 new Features (Auditing, Change Data Capture and Change Data Tracking)

There are some links which already I am following is given below:

Automatic properties and Object initializers
http://weblogs.asp.net/scottgu/archive/2007/03/08/new-c-orcas-language-features-automatic-properties-object-initializers-and-collection-initializers.aspx

LINQ Tutorials
http://weblogs.asp.net/scottgu/archive/2006/05/14/446412.aspx

Lambda Expression
http://weblogs.asp.net/scottgu/archive/2007/04/08/new-orcas-language-feature-lambda-expressions.aspx

WSSF Home page
http://www.codeplex.com/servicefactory

WSSF Hands on Lab
http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=servicefactory&ReleaseId=7846

Thanks
Brij Mohan

While designing the webpage we often struggle to maintain the consistency of our site across different browsers. To achieve this we use different browser hacks. But again that ends up with making our programming more complicated.

In this post I am going to give you the link of a JavaScript using which you just need to know basics of CSS.

CSS Browser Selector is a very small JavaScript with just one line and less than 1kb which empower CSS selectors. It gives you the ability to write specific CSS code for each operating system and each browser.

This can work for the following Browsers

  • Internet Explorer (All versions)
  • Mozilla, Firefox (all versions), Camino
  • Opera (All versions)
  • Konqueror
  • Safari, NetNewsWire, OmniWeb, Shiira, Google Chrome

I think we have almost covered all the browsers right, if I am missing any let me know.

Instead of writing everything again here, and making this post lengthy I will suggest you to visit this site to download the JavaScript code and instructions on how to use this from here.

The web project model changed in number of ways from Visual Studio 2003 to Visual Studio 2005, But one major part which is missing is the ability to version the assembly using AssemblyInfo.cs file.

This is because the model of VS 2005 dynamically creates multiple assemblies for each class file. Resulting in which we cannot have single named assembly to set version number.

We cannot change the default behaviour of compilation but we can change the way we can deploy our project files and assemblies, by using Web Deployment Project.

Microsoft Web Deployment Project adds numerous features which nicely integrates with Visual Studio 2005, out of which the most useful I found is:

More control over number of assemblies generated by a pre-complied web application as well as control over the naming of the output assemblies. Which means you can generate either single assembly for you entire project, and select the name and version you want for e.g Foo.dll, etc or generate the assemblies per directory/ pages or control.

The ability to customize and modify the web.config file during deployment, that means you need not to change you web.config file every time before making release or deploying the project, instead you can specify the web.config keys on Web Deployment project, that you use for deployment, like this you can customize any other web.config settings also.

These are the few things which I named here, if you want more information on how to install, and use this you can visit the Scott's Blog from the below link:

http://weblogs.asp.net/scottgu/archive/2005/11/06/429723.aspx

Or you can Download the VS 2005 Web Deployment Project from

WebDeploymentSetup.msi

Other Useful Links which may help you to further explore this subject

http://msdn.microsoft.com/en-us/library/aa479568.aspx

Web Deployment Projects Forum

I hope this will help you, if you have something to share on this topic, then please leave a comment.

Thanks

~Brij
More Posts Next page »