Powered By Blogger

Wednesday, October 27, 2010

Silverlight 4 -- How to Retrieve Huge Amount of Data from WCF Service

I was trying to figure out why my WCF service call was always throwing the generic NotFound exception when trying to retrieve large datasets. I had all the buffer limits set to 2147483647(int.MaxValue) at Silverlight service configuration file as well as WCF service configuration section under web.config. Some more analysis revealed that I was getting a System.Net.WebException, saying: The underlying connection was closed: The connection was closed unexpectedly. After some research, I found that I need to set the maxItemsInObjectGraph for dataContractSerializer to some higher value in my web.config.


Here I want to give the solution for you if you face this problem:

1. Enable Silverlight client to retrieve huge chunks of data by enabling large buffers. You need to increase buffer and message size limits for the binding inside ServiceReferences.ClientConfig with something like:
<system.serviceModel>
    <bindings>
                 <basicHttpBinding>
            <binding name="BasicHttpBinding_SilverlightWCFService"
                                  maxBufferSize="2147483647"
                maxReceivedMessageSize="2147483647">
                <security mode="None" />
            </binding>
                 </basicHttpBinding>
    </bindings>
    <client>
                <endpoint address=http://localhost:1252/SilverlightWCFService.svc
                         binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_SilverlightWCFService"
            contract="SilverlightWCFService.SilverlightWCFService" name="BasicHttpBinding_SilverlightWCFService" />
    </client>
</system.serviceModel>
2. Enable WCF service to send large amount of data. You need to set the binding buffer limits as well as tje DataContractSerializer’s maxItemsInObjectGraph value. Here’s an extract from web.config with all the limits set to maximum:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <!-- Create a custom binding for our service to enable sending large amount of data -->
            <binding name="MyBasicHttpBinding"
                maxBufferPoolSize="2147483647"
                maxReceivedMessageSize="2147483647"
                maxBufferSize="2147483647">
               
<readerQuotas
                                           maxArrayLength="2147483647"
                    maxBytesPerRead="2147483647"
                    maxDepth="2147483647"
                   
maxNameTableCharCount="2147483647"
                                           
maxStringContentLength="2147483647" />
                         </binding>
        </basicHttpBinding>
   </bindings>

    <behaviors>
        <serviceBehaviors>
             <!-- Enable the serializer to serialize greater number of records -->
             <behavior name="SilverlightWCFLargeDataApplication.Web.SilverlightWCFServiceBehavior">
                 <serviceMetadata httpGetEnabled="true"/>
                 <serviceDebug includeExceptionDetailInFaults="false"/>
                
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
             </behavior>
        </serviceBehaviors>
    </behaviors>

   
<serviceHostingEnvironment aspNetCompatibilityEnabled="false"/> 
    <services>
        <!-- Bind the WCF service to our custom binding -->
        <service behaviorConfiguration="SilverlightWCFLargeDataApplication.Web.SilverlightWCFServiceBehavior"
             name="SilverlightWCFLargeDataApplication.Web.SilverlightWCFService">
            <endpoint address="" binding="basicHttpBinding"
               
bindingConfiguration="MyBasicHttpBinding"
                                  contract="SilverlightWCFLargeDataApplication.Web.SilverlightWCFService"/>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        </service>
    </services>
</system.serviceModel>
Hope this post can help you. And you can visit here if you're looking for silverlight 4 hosting.

Tuesday, October 26, 2010

Integrating SharePoint 2010 and SQL 2008 R2

This is the problem:

I'm ready to install SQL Server 2008 R2 and SharePoint 2010 in a test environment.  I'm trying to decide whether to run SQL Server Reporting Services in SharePoint Integrated mode or native mode.   What are the advantages of running Reporting Services in SharePoint Integrated mode?  Can you provide an overview of what I need to do to get Reporting Services installed and running in SharePoint Integrated mode?



How to fix it?

The biggest advantage to running Reporting Services in SharePoint Integrated mode is that you can deploy data sources, reports, etc. to SharePoint document libraries instead of the Report Manager web application that Reporting Services creates for you.  Since your users are probably familiar with SharePoint this makes sense.  In addition your users can take advantage of the new version of Report Builder that came with SQL Server 2008 R2 and deploy their reports to SharePoint document libraries, leveraging SharePoint for security.  This is easier for them than using the Report Manager.  The users can be much more self-sufficient with SharePoint.
In this tip I will highlight the steps you will want to follow to get Reporting Services installed and integrated with SharePoint.  I'll be using SQL Server 2008 R2 and SharePoint 2010 Foundation.  SharePoint 2010 Foundation is the new name for what was formerly Windows SharePoint Services.  It is the version of SharePoint that is included with your Windows 2008 server license.  The steps for SharePoint 2010 Server are essentially the same.  In order to get a test environment up and running as quickly as possible, I will install everything on a single server.  I'm using Windows Server 2008 R2 64 bit; 64 bit is a requirement for SharePoint 2010.

Here we go: (Install SQL Server 2008 R2)

In the Setup Role step, choose SQL Server Feature Installation as shown below:



In the Reporting Services Configuration step, choose Install the SharePoint Integrated mode default configuration as shown below:



This allows the install to do the majority of the work, limiting the steps that you will need to perform to get Reporting Services integrated with SharePoint.

Now, Installing SharePoint 2010:

In order to successfully install SharePoint, there are a number of prerequisites that must be installed.  When you launch the SharePoint 2010 setup, make sure to first click Install software prerequisites as shown below:



After clicking Install software prerequisites the following screen is displayed:



Note that this step will automatically install anything that you need from the list of required products and updates.  In order to run Reporting Services in SharePoint Integrated mode, you need the SQL 2008 R2 Reporting Services SharePoint 2010 Add-in; this will be done for you.
Now we are ready to install SharePoint 2010 Foundation.  Click Install SharePoint Foundation on the splash screen (shown at the beginning of this section).  Since we are interested in a test environment choose Standalone as shown below:



The Standalone option is perfect for getting going quickly; it installs the software with all default settings.  While this approach requires the least amount of effort on your part, it does install an instance of the SQL Server Embedded Edition that can only be used by SharePoint; i.e. you can't leverage this SQL Server instance for the Reporting Services database.  In addition you truly get a standalone instance of SharePoint; you cannot add any other SharePoint servers.  Despite these limitations, I'm going to proceed with the Standalone option.
When the SharePoint 2010 Foundation installation is completed, you will be prompted to run the SharePoint Products Configuration Wizard.  You need to do that to in order to complete the configuration steps required to have a working installation of SharePoint 2010 Foundation.  When the SharePoint Products Configuration Wizard is finished, your browser will open to the SharePoint Team site that has been created for you.

How to Configure SSRS with SharePoint?

At this point we have Reporting Services 2008 R2 and SharePoint 2010 Foundation installed.  The next step is to configure Reporting Services SharePoint integration using SharePoint Central Administration.  Launch SharePoint Central Administration from the Start menu (it should be pinned to the Start menu; if not then select it from All Programs, Microsoft SharePoint 2010 Products group).  Click General Application Settings as shown below:

Click Reporting Services Integration as shown below:

Note that the Reporting Services options shown above will only appear after the SQL 2008 R2 Reporting Services SharePoint 2010 Add-in is installed.  I installed the add-in by running the Install software prerequisites option before installing SharePoint.
There are just a couple of things that you need to enter to complete the integration as shown below:



The following are the main points about the integration settings:

- You can get the Report Server Web Service URL from the Reporting Services Configuration Manager (in the Microsoft SQL Server 2008 R2, Configuration Tools program group).  Click on Web Service URL in the menu on the left.
- When you have everything running on a single server as I do in this example, choose Trusted Account for Authentication Mode.
- For Credentials you do need an account that is in the local Administrators group.  With everything on a single server it can be a local account, but I'm using a domain account.
- Choose Activate feature in all existing site collections.
After entering the required information and clicking OK, you should see the Reporting Services Integration Summary as shown below:



At this point Reporting Services is configured in SharePoint Integration mode.

Now, Preparing a Document Library
There is one last step that needs to be performed in order to create Reporting Services artifacts (e.g. shared data sources, report models, reports) in a SharePoint document library.  We need to add the appropriate content types to the document library and customize the New Document menu options.  For this example I created a brand new document library called Reports.
Navigate to the document library then click Library Settings as shown below:



SharePoint 2010 has a new ribbon menu.   You have to click on the Library tab in order to see the above (the other option is the Documents tab).  Click Advanced Settings on the page as shown below:



Click the Yes radio button under Allow management of content types then click OK:



You will be returned to the library settings page; click Add from existing site content types:

Select the Report Builder Model, Report Builder Report, and Report Data Source content types from the Available Site Content Types List, then click the Add button:

Click OK to return to the library settings page; click Change new button order and default content type:
Click OK to return to the library settings page; click Change new button order and default content type:



Change the Visible property and Position from Top as shown below:



Click OK, then return to the document tab for the document library.  Click New Document and you will now see the menu options as we have configured them:



Click Report Builder Report to launch Report Builder.  You should see Report Build 3.0 launch and you can now author reports, save them to a SharePoint document library, and of course run reports by simply clicking on them in the SharePoint document library.

Friday, October 22, 2010

How to Configure SharePoint Foundation 2010 for SharePoint Workspace 2010

SharePoint Workspace 2010 is the new version of Groove that will give you an offline copy of a SharePoint website and also allow you to work with a SharePoint site outside of a browser.  SharePoint Workspace 2010 is especially nice for editing documents in a SharePoint Document library.  SharePoint Workspace makes the SharePoint Document Library work just like a folder on your computer and will handle the synchronization of the documents back to the SharePoint server for you.
If you try connecting SharePoint Workspace 2010 to a default SharePoint Foundation 2010 installation you may get an error like this one:
---------------------------

Sync to SharePoint Workspace

---------------------------

SharePoint Workspace was unable to interpret the SharePoint location. Please check and ensure the location contains no typing errors.

---------------------------

OK Help

---------------------------


This is because the default configuration of SharePoint Foundation 2010 requires two configuration changes to allow SharePoint Workspace 2010 to work.
The first is to enable the Remote Differential Compression feature on the server that is hosting SharePoint.  This is used by SharePoint Workspace 2010 to send and receive the files for synchronization.
To enable Remote Differential Compression go to the Server Manager > Features and choose Add Features.


Check the box for the Remote Differential Compression feature and then click Install to enable this feature.


The second configuration change to allow SharePoint Workspace 2010 to work with your SharePoint Foundation 2010 server is to add an Alternate Access Mapping of the public facing DNS name (or IP address) to SharePoint using the SharePoint Central Admin.  If you are connecting to your SharePoint site using the machine name then this is not necessary, but if you are connecting over the Internet through either an IP address or DNS name then you will need to add this alternate access mapping.
The reason is that when SharePoint is first installed, the only way it thinks users are connecting to the server is through the machine name: http://machine_name (as if on a local intranet).  Since most likely SharePoint Workspace 2010 users will be connecting through a public facing DNS name (or IP address), you will need to add this DNS name (or IP address) as an alternate access mapping (indicating that this DNS name is the same as the machine_name and should map to the SharePoint site).
To add an Alternate Access Mapping to SharePoint Foundation 2010, visit the SharePoint Central Administration on the SharePoint Foundation 2010 server:


Once in the SharePoint Central Administration website, click on the Application Management link


Then under the Web Applications heading choose Configure alternate access mappings


Choose Edit Public URLs


And then select the public facing SharePoint website that you want to add an access mapping to.  You do this by changing the Alternate Access Mapping Collection (clicking on the “No selection” drop down button) to the website that is running on Port 80.


The  default name of the public facing SharePoint site is “SharePoint – 80” but you may have changed that when you configured your SharePoint site.


Once you have switched the Alternate Access Mapping Collection to the public SharePoint website (SharePoint – 80) then you can specify the Public URL by adding the publically accessible IP Address or DNS name to the Internet field:



Click Save to apply the alternate access mapping and now you should be able to connect to your SharePoint Foundation 2010 site with SharePoint Workspace 2010:



SharePoint Foundation 2010 is the free version of SharePoint that installs on top of Windows Server 2008.  With SharePoint Workspace 2010 you can get an offline copy of your SharePoint team site allowing you to add/edit your documents in any SharePoint document library easily and allow SharePoint Workspace 2010 to handle the file synchronization for you.

Wednesday, October 20, 2010

New Features ASP.NET 4.0


ViewStateMode – ViewState for Individual Controls
ASP.Net 4.0 allows view state in a page to be more controllable from page to its child controls level. That is, view state of a control can be enabled or disabled irrespective of its parent control’s view state. Even if view state of a page is disabled, controls of the page can have their own view state individually enabled or disabled or even inherited from the page’s view state mode property. This property if utilized properly can certainly boost performance of a page.
For example, we can individually enable or disable user control’s view state in a page.
By default, ViewStateMode is enabled for a page object, while controls have inherit mode.

Page.MetaKeywords and Page.MetaDescription – SEO Optimization Feature

ASP.Net 4.0 has come up with these two properties that will help developers add meta tags for keywords and description in the aspx pages in easier fashion. Web Search Engines really need these two meta tags for search indexing of any pages. These two properties can be used in a page in various ways. Inside <head> tag or in the code behind or even at <%@Page%> directive level.
However, setting meta keywords or description in code behind will be more useful when we have to add keywords and descriptions dynamically from source like database.
MetaKeyWords is used to store few useful keywords that will briefly highlight important information of a page by tags. From SEO perspective, meta keywords should contain keywords separated by spaces.
MetaDescription is used to add page description in short that will help Search Engines to quickly describe about the page links in search pages.

Prior to ASP.Net 4.0, we have to add meta tags using HtmlMeta control (public class HtmlMeta : HtmlControl) adding into page header as:
protected void Page_Load(object sender, EventArgs e)
{
//
HtmlMeta metakey = new HtmlMeta();
metakey.Name = “keywords”;
metakey.Content = “ASP.Net 2.0 3.5″;
HtmlMeta metadesc = new HtmlMeta();
metadesc.Name = “description”;
metadesc.Content = “ASP.Net 2.0 3.5 Page Description…”;
//Add to page header
Page.Header.Controls.Add(metakey);
Page.Header.Controls.Add(metadesc);
}
In ASP.Net 4.0, we can add in many ways.

protected void Page_Load(object sender, EventArgs e)
{
//Adding Page meta tags information
this.Page.MetaKeywords = “ASP.Net 4.0 SEO Meta Tag”;
this.Page.MetaDescription = “Serializing and Deserializing Thoughts..”;
}
Or,

<head runat="”server”">
<title>Feature: ViewStateMode</title>
<meta name=”keywords” content =”ASP.Net 4.0 ViewStateMode”/>
<meta name=”description” content=”ViewStateMode feature in ASP.Net 4.0″ />
</head>
Or inside Page directive,



Response.RedirectPermanent – Search Engine Friendly Webpage Redirection
In classic ASP or ASP.Net earlier than 4.0, we used to redirect to new pages or links by setting Response.StatusCode to 301 before calling Response.AddHeader method. Now ASP.Net 4.0 has provided Response.RedirectPermanent method to redirect to new pages or links with StatusCode of 301 implicitly set. Search Engines use this 301 code to understand permanent redirection from old pages links.
For example, Classic ASP method:

<%@ Language="VBScript" %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”,http://www.new-page-url.com/
%>
ASP.Net method prior to 4.0:

<script runat="”server”">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(“Location”,”http://www.new-page-url.com”);
}
</script>
ASP.Net 4.0 method:

Response.RedirectPermanent(“http://www.new-page-url.com “);
Web.Config Refactoring – Custom HttpHandlers and HttpModules
Web.config now looks cleaner as most of the settings are controlled from machine.config file as ASP.Net 4.0 is all set to benefit from IIS 7 and IIS 7.5 features. When IIS is set to use .Net 4.0 and Integrated Pipeline mode, <compilation> element holds .Net version attribute. And the traditional <httpHandlers> and <httpModules> section is now shifted out of <system.web> and added inside new section <system.webserver>. All the custom handlers are added inside <handlers>, and all the modules inside <modules> section.

<system.webServer>
<!– Add the module for Integrated mode applications –>
<modules runAllManagedModulesForAllRequests=”true”>
<add name=”MyModule” type=”WebAppModule.MyCustomModule, WebAppModule” />
</modules>
<!– Add the handler for Integrated mode applications –>
<handlers>
<add name=”MyHandler” path=”svrtime.tm” verb=”GET” 
    type=”WebAppModule.MyCustomHandler, WebAppModule” preCondition=”integratedMode” />
</handlers>
</system.webServer>
Also,

<system.web>
<compilation debug=”true” targetFramework=”4.0″ />
Interesting point is, when we add custom handlers and modules this way, we do not have to manually configure handlers and modules in IIS again. IIS will automatically refresh itself.

Tuesday, October 19, 2010

Many New Features inSharePoint 2010 - Part III

This is the final part of my article. You can find the first and the second part of this article at Many New Features in SharePoint 2010 - Part 1 and Many New Features in SharePoint 2010 - Part 2.

21. Improved Enterprise Search
SharePoint 2010 offers several new ways to customize and extend enterprise search capabilities. SharePoint 2010 provides following two main enterprise search options:

- SharePoint Server 2010 Search – the out-of-the-box SharePoint search for enterprise deployments included by default with SharePoint 2010.
- FAST Search Server 2010 for SharePoint – a brand new add-on product based on the FAST search technology that combines the best of FAST’s high-end search capabilities with the best of SharePoint.

Following are some of the new and enhanced capabilities introduced in the Enterprise Search area:

- New Custom Ranking Models allow you to change the weights that are used by SharePoint Search to rank results. Custom Ranking Models are used in conjunction with the Core Results web part.
- You can scale out the number of crawl/indexer components by adding additional servers to the farm and configuring them as crawlers which enables to increase crawl frequency, volume, and performance by distributing the crawl load among several servers, along with providing indexer redundancy if a server fails.
- SharePoint 2010 has capability to integrate FAST Search Server 2010 seamlessly.
- SharePoint 2010 supports wildcard search.
- Suggestions while typing search queries
- Improved "did you mean" suggestions togethor with suggestions for related searches.
- Faceted search is another new feature in SharePoint Search 2010. When a search query returns a lot of results the faceted search functionality displays a refinement panel on the left side which can be used to refine the results based on criteria like Result type, Site, Author, Modified Date, Tags, etc.
- Phonetic name matching and nickname matching - Users can search for a person by name without knowing the exact spelling of the name.

22. New and improved Social Features
As you know the previous version of SharePoint (MOSS 2007) lacked on some of the main social features and developers needed to develop their own components to implement social features on top of SharePoint 2007. But now Microsoft has filled that gap in SharePoint 2010.

Following are some of the main social features introduced in SharePoint 2010:

- Tags, Notes, and "I Like It" - Now in SharePoint 2010, a user can add tags and notes with any page which can be either public or private. A user can also mark a page if he/she liked that page. SharePoint 2010 adds two icons "I Like It" and "Tags & Notes" in all the pages to provide this functionality.
- Ratings- SharePoint 2010 allows users to rate items within SharePoint site, such as ratings various items within Document libraries, custom lists, blog posts, discussions threads, etc.
- Tag Cloud- SharePoint 2010 includes an out-of-the-box tag cloud which can be added to any page within the SharePoint site.
- Newsfeed- Newsfeed is another features included in the SharePoint 2010. You can set the types of updates you want to get in your newsfeed. You can set this using the out-of-the-box settings section available within the user profile page.

23. New Claims-Based Authentication Model
SharePoint Foundation 2010 incorporates a new authentication model that works with any corporate identity system, including Active Directory Domain Services, LDAP-based directories, application-specific databases, and user-centric identity models.

24. SharePoint Health Analyzer
SharePoint Health Analyzer is a feature included in the SharePoint 2010 that allows administrators to schedule regular, automatic checks for potential configuration, performance, and usage problems in the server farm. Any errors that SharePoint Health Analyzer finds are identified in status reports that are made available to farm administrators in Central Administration. Status reports that are produced by SharePoint Health Analyzer explain each issue, list the servers where the problem exists, and outline the steps that an administrator can take to treat the problem. In some cases, errors are repaired automatically as soon as they are found, and it also informs farm administrators about the repairs done.

25. Multi-Tenant Hosting
SharePoint 2010 has capabilities for Multi-Tenant Hosting which allows to setup hosting on site collection level. Now you can host customer1 (tenant 1) on a site collection and customer2 (tenant 2) on another site collection within same web application. Each tenant will only have administrator access to his/her site collection. Also, service applications will keep each tenants data separate from another tenants.  For example, one shared search service application will service tenant1/site collection 1's data and tenant2/site collection 2's data while keeping them separate from each other.

26. Microsoft Office Web Applications
Microsoft Office Web Apps (OWA) is the online companion to Office Word, Excel, PowerPoint and OneNote applications that enables users regardless of their location to access documents and edit documents. Users can view, share, and work on documents with others online across personal computers, mobile phones, and the Web.

Office Web Apps is tightly integrated with SharePoint 2010 Products. The Office Web Apps Feature and services integrate with SharePoint's robust enterprise content management capabilities. Now all of those Office documents in your SharePoint environment can now be viewed and edited from almost any browser, anywhere. Office Web Apps also includes PowerPoint Broadcast Slide Show, allowing users to view PowerPoint presentations live, even when they’re a thousand miles away.

For consumers and small-business users, Office Web Apps will be available on Windows Live as a free service. Business customers licensed for Microsoft Office 2010 through a Volume Licensing program can run Office Web Apps on a server running Microsoft SharePoint Foundation 2010 or Microsoft SharePoint Server 2010.

Some of the Office Apps also support multi-user editing in different scenarios like excel in Office Web Apps but not in Client, OneNote in both Office Web Apps and Client, etc. All the updates done using Office Web Apps occur in near real time.

27. New and Improved Web Analytics Capabilities
SharePoint Server 2010 includes a set of new features to help you collect, report, and analyze the usage and effectiveness of your SharePoint 2010 deployment – whether it’s used as an internal or external web portal, a collaboration tool or a document and records management repository.  SharePoint 2010 provides a set of Web Analytics reports available out-of-the-box. There are following three major categories of reports:

- Traffic reports: These reports provide metrics such as:

1. How much traffic your site gets (Number of Page Views);
2. Who visits your sites (Top Visitors);
3. How visitors arrive at your site (Top Referrers);
4. Daily Unique Visitors, Top Destinations, Top Browsers, etc;

- Search reports: These reports give you insight into what users are searching for, for example:

1. How many times users searched (Number of Queries);
2. What were the most used search terms (Top Queries);
3. What queries have high failure rates (Failed Queries);
4. Best Bet Usage, Search keywords, etc;

- Inventory reports: These reports display key metrics regarding the inventory of your sites:

1. What is the total disk drive space user (Storage Usage);
2. How many sites exist (Number of Sites);
3. Top Site Product Versions, Top Site Languages, etc;

You can access Web Analytics reports by going to Site Actions -> Site Settings. Under Site Actions heading you will see two links, Site Web Analytics Reports and Site Collection Web Analytics Reports. When you click on either link, you are taken to an overview page shows you key metrics for your site. You can then drill down to other reports by clicking on the left navigation, and can also change date range by clicking on Analyze tab on Ribbon.

Monday, October 18, 2010

Many New Features inSharePoint 2010 - Part II

Hi all, how do you do? This is the second part of my previous article about New Features and Enhancements in SharePoint 2010. You can visit first part of this article at New Features and Enhancements in SharePoint 2010 – Part I.

11. New Hardware and Software requirements
SharePoint 2010 will ship only as a 64-bit product. So if you are planning to upgrade SharePoint 2007 into SharePoint 2010 and if you have deployed your SharePoint 2007 site into 32-bit environment then it's definitely a consideration to do the upgradation.
In addition to new hardware requirements, SharePoint 2010 will require an x64 edition of either Windows Server 2008 or Server 2008 R2. It also requires a 64-bit version of Microsoft SQL Server 2008 or SQL Server 2005.

12. Business Connectivity Services (BCS)
Business Connectivity Services (BCS) provides read/write access to external data from line-of-business (LOB) systems, web services, databases, and other external systems within Microsoft SharePoint 2010. If you have worked on SharePoint 2007 (MOSS 2007), you must be aware of Business Data Catalog (BDC). In SharePoint 2010, Business Data Catalog has been replaced by Business Connectivity Services.
Business Connectivity Services supports all the features provided by Business Data Catalog together with a lot of new features and capabilities. Following are some of the new features of Business Connectivity Services:

- Using BCS, you can read and write back to external systems from SharePoint 2010 site. Using BDC in SharePoint 2007 site, you were able to read data from external system but it didn't support to write back to external system.
- BCS supports cache-based and offline work features. Now users can manipulate external data when they are working offline and all the read/write operations performed against cached external data are synchronized when connection to the server becomes available.
- BCS supports reading binary large object (BLOB) data from the external system.
- Enhanced object model and APIs which enables developers to write generic applications to work against any external system.
- BCS provides batch and bulk operation support. So now it is possible to read multiple items in a single call which reduces the round trips to the external systems significantly.
- External data can be converted to a list like view very easily using External Lists.

13. Visio Services
SharePoint 2010 is equipped with Visio Services which allow you to share data linked diagrams in real time. Using Visio Services you can connect to backend, visualize the data and publish the Visio diagram into your SharePoint site. Visio data diagrams can be rendered without the need for Visio on the client computer.

14. New and enhanced SharePoint Designer 2010
To work with SharePoint 2010, Microsoft has also introduced a new version of SharePoint Designer called as "SharePoint Designer 2010". Following are some of the new features and capabilities introduced in SharePoint Designer 2010:

- Improved User Interface together with Ribbon which improves its usability and make it consistent with the UI of SharePoint 2010 and other office applications.
- Quick Launch Navigator and Site Content Structure for Site information
- Using Site Content Structure, you can create a: Web Part page, Master Page, list, and workflow
- Permissions can be set for individual users
- Saving and deleting site templates is now possible
- Ability to use XSLT List View Web Parts to show dynamic views of your data
- Support for attaching workflows to content types
- Support for workflow templates
- Create Content Types and attach to lists
- New concept of "Entities" which provides seamless integration with back-end systems


15. SharePoint Best Practices Analyzer
SharePoint 2010 is equipped with SharePoint Best Practices Analyzer which provides Microsoft's guidance for SharePoint implementation and troubleshooting and creates detailed reports to help administrators achieve greater performance, scalability, and uptime. A Problems and Solutions page in the analyzer helps you solve common implementation problems.

16. Usage Reporting and Logging
SharePoint 2010 includes a new database designed to support usage reporting and logging. The name of the database it creates is "WSS_Logging". SharePoint 2010 keeps tracks of everything it does by logging into the WSS_Logging Database. If you remember in SharePoint 2007, Microsoft has recommended to not access any SharePoint database directly. But in SharePoint 2010, the logging database is the only database that Microsoft will be happy to let the developers directly read, query and build custom reports against it.

17. Developer Dashboard
Developer dashboard is a new feature introduced in SharePoint 2010 which displays the performance and tracing information in the bottom of every page likw how long did the request take to run?, what event handlers were fired?, In what sequence did these event handlers fire?, etc. Developers can use this information to debug and troubleshoot issues with page rendering time.  By default this feature is disabled, but we can enable this feature in the development environments to get this additional information.


18. New SharePoint Developer Tools in Visual Studio 2010
Microsoft has introduced a new set of tools within the Visual Studio 2010 which make developing SharePoint applications as easy as any other .net applications. The new tools include project templates for many of the SharePoint application types, such as Web Parts, List definitions, Modules, Application Pages, Workflows, user Controls and others. A great feature in Visual Studio 2010 is the Visual Web part Designer. Now you don't need to build tables for layout, you can just drag and drop and create controls within web parts, similar to ASP.Net forms and user controls.

19. Client Object Model
The Client Object Model (OM) is a new programming interface for SharePoint 2010 where code runs on a user’s client machine against a local object model and interacts with data on the SharePoint Server. Client OM methods can be called from JavaScript, .NET code or Silverlight code and makes building rich client applications for SharePoint easy.

20. Language Integrated Query (LINQ) for SharePoint
Now in SharePoint 2010, you can use Language Integrated Query (LINQ) objects to query SharePoint lists. Earlier in SharePoint 2007 (MOSS 2007), using CAML queries was the only way to query SharePoint lists.

Sunday, October 17, 2010

Many New Features in SharePoint 2010 - Part I

Here are some new features and enhancements introduced in SharePoint 2010, which are listed below:

1. New User Interface including Ribbon
User Interface is changed a lot in SharePoint 2010 and now you will be able to do more with few clicks. There are a lot of changes in the User Interface like, "Site Actions" menu is moved to left side of the page, some new options has been added in the "Site Actions" menu, the overall look and feel of the site is different as compared to SharePoint 2007, asynchronous user interface using AJAX and SilverLight which leads to minimal postbacks and improved performance of the site.
But the biggest change in the User Interface of SharePoint 2010 is the addition of Ribbon UI. Microsoft has earlier introduced the Ribbon UI with Office 2007. Now the same Ribbon UI is available in the SharePoint 2010 which brings the SharePoint user experience much more aligned with other office applications. You can see the Ribbon in the top area of any page in the SharePoint 2010 website, see the below screenshot.


Ribbon provides users access to various operations they can choose from. The Ribbon changes automatically for edit mode and view mode of a page. Ribbon also changes depending on what you are looking, like if you open a document library it displays document library related operations together with other common operations.

2. Built-in SilverLight Support

SharePoint 2010 allows adding SilverLight components without any additional configuration. First you will need to upload your SilverLight XAP file into a document library, then add SharePoint's OOTB SilverLight web part on a page and point it to the respective XAP file uploaded in the document library, that's it; SilverLight XAP component will be successfully added and displayed in the page.

3. Rich and Improved Theming Support

SharePoint 2010 provides built-in office-style themes just like in Word and PowerPoint. You can choose and apply a theme to change the look and feel of the web site as per the selected theme. You can also preview a theme on the web site before applying it. You can also imports themes from Microsoft PowerPoint. You can also create custom themes for SharePoint 2010 websites.

4. Multiple Browser Support

SharePoint 2010 supports Internet Explorer 7/8, Firefox, and Safari. But it will not support Internet Explorer 6.0 or less any more. Also there is no official news about its support for Chrome and Opera.

5. Rich Media support and Digital Asset Management
SharePoint 2010 offers Rich Media capabilities out-of-the-box and makes it very easy for users to share videos, audio, pictures, and other rich media files. A new asset library has been introduced in SharePoint Server 2010 which is specially designed to manage and share digital assets like video, audio, pictures, and other rich media files. Couple of web parts and controls has been also added to streamline the Digital Asset Management capabilities.
SharePoint 2010 includes a Media web part built using Silverlight, Video content type, Audio content type, and Image content type.

6. SharePoint Workspace

Microsoft Office Groove has been renamed to SharePoint Workspace in SharePoint 2010. SharePoint Workspace provides local and offline read-write access to SharePoint lists and libraries and also incorporates offline-online synchronizations. SharePoint Workspace is not only got new name but also a lot of new functions and better design.

7. Sandboxed Solutions               
If you remember, in SharePoint 2007 all the solutions (.WSP) runs with full trust which requires farm administrators to pitch in and deploy the solutions. Also the solutions can be deployed at the minimum at a web application level. It means if a solution is deployed in a web application, it will be applicable for all the site collections available in that web application.

In SharePoint 2010, Sandboxed Solutions also called as User Solutions, is a new concept which addresses the above issue by allowing site collection administrators to deploy solutions at the site collection level which is safe to run and not affect the other site collections and web applications running on the same farm. Farm administrators can monitor sandboxed solutions and place restrictions on the resources, such as memory and CPU cycles, they can use. Sandboxed Solutions does not cover full SharePoint object model but it addresses the key scenarios like custom web parts and event receivers.

The solution deployment as in SharePoint 2007 is still exists in SharePoint 2010 but those solutions are called as Farm solutions.

8. Stsadm command-line tool is superseded by Windows PowerShell 2.0

In SharePoint 2010, the Stsadm command-line tool has been deprecated and it will be superseded by Windows PowerShell 2.0. SharePoint 2010 will still support the Stsadm command-line tool for backward compatibility with previous product versions. But it is recommended to use Windows PowerShell 2.0 when performing command-line administrative tasks.

9. Redesigned Central Administration web site

Central Administration web site has been redesigned in SharePoint Server 2010 to provide a better user experince and make it easier for administrators to find what they are looking for. The home page for Central Administration groups major functional areas (for example - Application Management, Monitoring, Security, and so on) together and lists many of the most commonly used tasks under each area. The Central Administration web site is also eqquiped with Ribbon UI which makes it easier for administrators to view or change details by making common configuration options a single click away.

10. Shared Service Provider (SSP) no more exists

In SharePoint 2010, Shared Service Providers (SSP's) are no more available. SSP's have been replaced by Service Applications in SharePoint 2010. Earlier in SharePoint 2007, all services were combined into a SSP. Now is SharePoint 2010, all services are running as independent Service Application. You can select and configure from available services to run on an application server. You can also select and configure only required services for a particular web application.

Thursday, October 14, 2010

Reasons Why I Like and Excited about ASP.NET MVC 3.0

Reasons why I’m excited about ASP.NET MVC 3:

1. New Helpers

Helpers is an area ASP.NET MVC has been lacking at, compared to other MVC frameworks. MVC 3 will have new helpers that tend to close that gap:

- Chart – helps creating charts. Very nice!
- WebGrid – renders a collection of objects as a grid including paging and sorting. Should output a plain HTML table. Hopefully that’s all there is to it…
- WebImage – helps in creating images. This also contains methods for basic image operations like rotating.
- WebMail – used to send emails.

The next helpers have been referred to as “task-based helpers”. They should have been a part of the beta version but they’re not there… I hope they’ll make it to the release version because they are just pure awesomeness:

- Video – contains methods like Video.Flash, Video.Silverlight and Video.MediaPlayer which allow adding their corresponding HTML tags with ease.
- Twitter – contains basic twitter operations like rendering the twitter stream for a specified user or the results of a given search.
- ReCapcha – helps using the reCAPTCHA service.
- Gravatar – helps consuming a user’s avatar from the Gravatar service.
- Analytics – provides different methods like GetGoogleHtml, GetStatCounterHtml or GetYahooHtml that render the required javascript code for the different analytics services.

2. Support for Unobtrusive jQuery-Based Ajax

In ASP.NET MVC 3, Ajax.ActionLink, Ajax.RouteLink, Ajax.BeginForm and Ajax.BeginRouteForm will use JQuery to connect to the server. In addition, they will not use inline javascript, and instead they will call functions placed within javascript files.

3. Better Extensibility with new Dependency Injection Support
 ASP.NET MVC 3 will contain numerous extensibility possibilities. Almost anything can be extended using DI, which opens so much opportunities. Just what extensibility means! As you can read Brad Wilson’s post for a detailed guide to these new extensibility features.

4. NuPack Integration

NuPack is Microsoft’s new packaging system and it is fully integrated with ASP.NET MVC 3. Right click on the References folder in the Solution Explorer and choose “Add Package Reference…”:

Now, you can get this all new features of ASP.NET MVC 3.0 at here.

ASP.NET MVC Hosting -- Create a DropDownList with ASP.NET MVC

The DropDownList html helper differs a bit from the standard Html helper methods, and, not surprisingly, the way it works is one of the questions I get asked the most. So in this post I’m going to dissect this method, and show you how to use it.

Standard Html Helpers
One of the cool features of ASP.NET MVC is the automatic binding of html form fields: all the Html helper methods will auto-magically take the default value of the form field directly from the ViewData or the view model object with the same name of the control.
Calling the TextBox helper method:
<%= Html.TextBox("Name") %>

will results, if the view model supplied contained the property Name, in the following HTML:
<input id="Name" name="Name" type="text" value="Simone" />

It would have been the same as calling the other helper overload, which specifies both the name and the value:
<%= Html.TextBox("Name", Model.Name) %>

Introducing the DropDownList helper
But things get a bit more complex when it comes to the HTML Select element, which most ASP.NET developers know as DropDownList. This control needs two values to be retrieved from the ViewData: the list of items to be displayed in the drop down, and the item that needs to be pre-selected, so the code to set it up is a bit more complex.
The automatic binding of the other html helpers still works but, since it can bind only one thing at the time, depending on your preferences you have and the scenario you are facing, you have to decide whether you want to automatically bind the list item or the selected item.

The method signature

Let’s have a look at the method signature:

Html.DropDownList(

    string name,

    IEnumerable<SelectListItem> selectList,

    string optionLabel,

    object htmlAttributes)


and the meaning of the parameters:

- name – the name of the HTML select element, and also the name of the view model property that is bound to the element
- selectList – the list of options of the select list
- optionLabel – the text that will be added at the top of the select list. Usually something like “Select …”
- htmlAttributes – this is in common with all the other html helper. A dictionary or an anonymous type with the html attributes you want to add to the HTML element

All the parameters except the first one are optional: if only the name is provided, the helper will automatically bind the list item. Otherwise if both the name and selectList are provided, the select item will be bound, and the select list will be the one supplied with the parameter. You’ll see how to adopt each approach later.

The SelectListItemClass
But now let’s have a look at the presentation model class used to represent the drop down list with its options: SelectListItem.
This class has three properties:

- string Text – the string that will be displayed as text of the option
- string Value – the string that will be used as the value of the option
- bool Selected – whether the option is selected

How to write a DropDownList

Let’s now have a look at the two possible way of building a DropDownList.

Autobinding the ItemList

The first approach consists in setting up the whole list of items in the controller, specifying also which options must be the selected item.
List<SelectListItem> items = new List<SelectListItem>();
items.Add(new SelectListItem
        {
          Text = "Swimming",
          Value = "1"
        });
items.Add(new SelectListItem
        {
            Text = "Cycling",
            Value = "2",
            Selected = true
        });
items.Add(new SelectListItem
        {
            Text = "Running",
            Value = "3"
        });


As you can see, you set the text and value for each option, and set Selected = true for the item you want to be selected. And then you call the helper, specifying only the name: this will be the name of the select element, and must be the same name of the property of the view model that contains the list of items (in the sample named ListItems).
<%= Html.DropDownList("ListItems") %>

But in case you are caching the list of items or are retrieving them separately from the item that must be selected this is not the best solution.

Autobinding the selected item
The other approach is to automatically bind the selected item, and passing the list of items as parameter to the DropDownList helper method.
In the controller you do exactly the same thing as before, just don’t set to true the Selected property of any item. Then you also have to put into the view model the value of the item you want to select.
var model = new IndexViewModel()
        {
            ListItems = items,
            SelectedItem = 2
        };


And finally in the view, you use the overload which accepts also the selectList parameter:
<%= Html.DropDownList("SelectedItem", Model.ListItems) %>

The only difference in the HTML rendered is that, with first approach, the name of the HTML select element is “ListItems”, with the second it is “SelectedItem”.
These approaches are fine if you are creating your own list, but they are not the optimal solution if you are receiving the list of options for an external method, for example from a DB repository.

Using the SelectList helper class
To address the latest scenario the ASP.NET MVC framework comes with a class that helps you build the list of items in a way that can be accepted by the DropDownList html helper: it’s called SelectList.
This class encapsulates all the information needed to create a list of SelectListItem:

- Items – any IEnumerable containing the list of items that needs to be in the select element
- DataTextField and DataValueField – the names of the properties that will be used as text and as value of the item
- SelectedValue – the value of the selected item

Using this you can take any list of objects and turn it into a list of SelectListItem
//with selected value specified
var selectItems = new SelectList(brands, "BrandId", "BikeBrand", 2);
//only the items list

var selectItems = new SelectList(brands, "BrandId", "BikeBrand");
And you can use it either specifying the selected value in the controller, and using the overload with just the name parameter, or specifying the selected value as additional property in the view model and using the overload that takes both the name and the selectList property (same as the first two approaches).

Tuesday, October 12, 2010

8 Things That Make SharePoint 2010 a True ECM System

1. Managed Metadata
Companies often require the use of approved terms from a centrally controlled taxonomy. The SharePoint 2010 response is managed metadata, which is the ability to create, manage, and publish term sets across the enterprise from a single point of reference. Term sets are hierarchical trees, internally connected structures that display parent-child relationships. Term sets and content type galleries are available to any site collection that can securely access the url for the managed metadata service. With the new service structure, we have finally connected the metadata islands into a coordinated lattice of consistent terminology.

2. Document Sets

Individual documents often belong to a larger construct that is what the organization really needs to manage. Consider the typical proposal. A proposal is actually an ecology of documentation, containing PowerPoint presentations, Microsoft Word documents, qualifications, case studies and so on. What matters at the end of the process is the complete portfolio of documents. The Document Set allows multiple items to be treated as one in terms of workflow, compliance, and versioning. Versioning is applied to the Document Set as a whole, allowing us to capture snapshots of the version of each document at a point in time in case we need to roll back. Workflows can operate against the entire Document Set to automate the process of integrating component documents into a master deliverable. Each document can be routed to different approvers. As each part passes through the review process, the master deliverable can be assembled from subsidiary workflows spawned during the approvals.


3. Document IDs

When a major piece of ECM infrastructure turns up missing, many of the guests in the SharePoint house start staring anxiously at the ceiling, wondering what else might have been forgotten. In MOSS 2007, moving or renaming documents changed their urls because documents were unbreakably tied to the library they inhabited. With SharePoint 2010, documents are free to roam across site collections, secure in their identity, which is now stamped with a unique ID. This is an enabling technology behind Document Sets, since all the component parts must have persistent links. Rather than scattering copies of business records across the site, record content can now represent a single source of truth.

4. Content Organizer

In MOSS 2007, content organization was largely a matter of individual upload decisions. Administrators could help guide those decisions, but ultimately, it was up to the contributors to decide where the content ended up. The new Content Organizer allows routing decisions to be centrally organized. It takes these decisions out of the hands of users and ensures that items are well organized. Users are guided to enter appropriate metadata rather than being allowed to dump documents wherever they like.

5. Location-based metadata defaults

In MOSS 2007, folders had no function other than to act as dumb containers. "Dumb" here means that they couldn't pass values to their contents or add any help to browsing and searching other than their names. Folders are now first-class objects. Documents and subfolders can inherit metadata from their parent folder. How much easier it is to find documents when metadata is automatically added, instead of forcing users to add the same value over and over to the hundred documents they just uploaded.

6. In-place Records Managements
MOSS 2007 records management was more a rough draft than a real product. The most noticeable oversight was the lack of support for a usable file plan. Records could not inherit metadata or information policies. You could not route documents to a specific folder in a records library, but only to the records library itself. With SharePoint 2010, folder-based inheritance enables hierarchical file plans to be created in the Records Center (or anywhere else for that matter). We can now create policies that propagate across the inheritance hierarchy for a set of nested folders. In addition, record management can now take place anywhere that the feature is activated and compliance details for any item are only a click away.
7. Search
The new search system keeps track of how often search results are clicked on and feeds these metrics into relevance ranking. The more popular the link, the higher it rises in the results list. The new Refinement Panel sorts results into facets such as Author, File-type or Location. Even better, it also organizes the results by metadata attribute such as Proposal, RFP, or Update Notification. It may not be the holy grail of automatic classification, but it makes the benefits of tagging immediately obvious to the user.
8. Auditing
In SharePoint 2010, full-featured auditing is as close as the Compliance Details screen, a new menu item added to every document. It brings many useful details to the surface, such as who opened, edited, checked out, moved, deleted or even searched for the document in question.

Now, you can find all the new features SharePoint 2010 at http://asphostportal.com/Windows-Sharepoint-2010-Hosting.aspx with very low rate. For us, customer satisfaction is our pleasure.

Binding and IDataErrorInfo in Silverlight 4

Silverlight 3 introduced the idea of types throwing exceptions from their setters as a way of reporting errors back to the UI. That works well but there are other ways of achieving that kind of error status from a type and the IDataErrorInfo interface has been around for a while as a way of doing this ( introduced in Windows Forms and then added to WPF V3.5 at a later point ).
It’s a simple enough interface;
// Summary:   
//     Defines properties that data entity classes can implement to provide custom   
//     validation support.   
public interface IDataErrorInfo   
{   
  // Summary:   
  //     Gets a message that describes any validation errors for the object.   
  //   
  // Returns:   
  //     The validation error on the object, or null or System.String.Empty if there   
  //     are no errors present.   
  string Error { get; }     
  // Summary:   
  //     Gets a message that describes any validation errors for the specified property   
  //     or column name.   
  //   
  // Parameters:   
  //   columnName:   
  //     The name of the property or column to retrieve validation errors for.   
  //   
  // Returns:   
  //     The validation error on the specified property, or null or System.String.Empty   
  //     if there are no errors present.   
  string this[string columnName] { get; }   
}

whereby a caller can enquire about the general state of an object or about specific properties. Lots of people have implemented this in the past for Windows Forms applications and might;

- be very familiar with the interface so want to keep using it
- want to avoid the model of “have to throw an exception in a setter in order to validate the object”
- have a bunch of code that already uses IDataErrorInfo and want to keep using it

and so Silverlight 4 adds support for IDataErrorInfo. I can go and make myself a pretend class like this one;

public class Person : IDataErrorInfo   
{   
  public string FirstName   
  {   
    get  
    {   
      return (firstName);   
    }   
    set  
    {   
      firstName = value;   
    }   
  }   
  public string LastName   
  {   
    get  
    {   
      return (lastName);   
    }   
    set  
    {   
      lastName = value;   
    }   
  }   
  public int Age   
  {   
    get  
    {   
      return (age);   
    }   
    set  
    {   
      age = value;   
    }   
  }   
  [Display(AutoGenerateField=false)]   
  public string Error   
  {   
    get { return (null); }   
  }   
  [Display(AutoGenerateField = false)]   
  public string this[string columnName]   
  {   
    get  
    {   
      string error = null;   
  
      switch (columnName)   
      {   
        case "FirstName":   
          if (string.IsNullOrEmpty(firstName))   
          {   
            error = "Provide a first name";   
          }   
          break;   
        case "LastName":   
          if (string.IsNullOrEmpty(lastName))   
          {   
            error = "Provide a last name";   
          }   
          break;   
        case "Age":   
          if ((age < 0) || (age > 120))   
          {   
            error = "Age out of range";   
          }   
          break;   
      }   
      return (error);   
    }   
  }   
  string firstName;   
  string lastName;   
  int age;   
}
then I can wrap it up into a UI by feeding it as the DataContext of a DataGrid as below;

public partial class MainPage : UserControl   
{   
  public MainPage()   
  {   
    InitializeComponent();   
  
    this.Loaded += (s, e) =>   
      {   
        this.DataContext =    
          new Person[] { new Person() { FirstName = "Fred", LastName = "Smith", Age = 22 } };   
      };   
  }   
}

with the corresponding XAML file;

<UserControl x:Class="SilverlightApplication25.MainPage"  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
    xmlns:dg="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  
    mc:Ignorable="d"  
    d:DesignHeight="300" d:DesignWidth="400">
  
    <Grid x:Name="LayoutRoot" Background="White">  
        <dg:DataGrid  
            ItemsSource="{Binding}" />  
    </Grid>  
</UserControl>
and that gives me a UI that knows about its errors as in;

Naturally – this isn’t just a DataGrid thing, it applies to regular controls and DataForms and so on and should help in getting a bunch of code across to Silverlight 4. In terms of making use from regular controls, if we switch our UI to be something like;

<UserControl  
    x:Class="SilverlightApplication25.MainPage"  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
    mc:Ignorable="d"  
    d:DesignHeight="300"  
    d:DesignWidth="400">  
    <UserControl.Resources>  
        <Style  
            TargetType="Button">  
            <Setter  
                Property="Margin"  
                Value="5" />  
        </Style>  
        <Style  
            TargetType="TextBlock">  
            <Setter  
                Property="Margin"  
                Value="5" />  
        </Style>  
        <Style  
            TargetType="TextBox">  
            <Setter  
                Property="Margin"  
                Value="5" />  
        </Style>  
    </UserControl.Resources>  
  
    <StackPanel  
        x:Name="LayoutRoot"  
        Background="White"  
        BindingValidationError="OnValidationError">  
        <StackPanel  
            Orientation="Horizontal">  
            <TextBlock  
                Text="First Name " />  
            <TextBox  
                MinWidth="192"  
                Text="{Binding Person.FirstName,Mode=TwoWay,ValidatesOnDataErrors=True,NotifyOnValidationError=True}" />               
        </StackPanel>  
        <StackPanel  
            Orientation="Horizontal">  
            <TextBlock  
                Text="Last Name " />  
            <TextBox  
                MinWidth="192"  
                Text="{Binding Person.LastName,Mode=TwoWay,ValidatesOnDataErrors=True,NotifyOnValidationError=True}" />  
        </StackPanel>  
        <StackPanel  
            Orientation="Horizontal">  
            <TextBlock  
                Text="Age " />  
            <TextBox  
                MinWidth="192"  
                Text="{Binding Person.Age,Mode=TwoWay,ValidatesOnDataErrors=True,NotifyOnValidationError=True}" />  
        </StackPanel>  
        <Button  
            Content="Submit" IsEnabled="{Binding NoErrors}"/>  
    </StackPanel>  
</UserControl>
note that I’ve set the ValidatesOnDataErrors property of these TextBoxes to be True which causes them to do the right thing around IDataErrorInfo. I’ve also set the NotifyOnValidationError but that’s a Silverlight 3 thing and I’m really using that to count errors as they occur and get fixed so that I can enable/disable my Submit button based on that.
The code behind this I changed to;
public partial class MainPage : UserControl, INotifyPropertyChanged   
{   
  public MainPage()   
  {   
    InitializeComponent();     
    this.person = new Person() { FirstName = "Fred", LastName = "Smith", Age = 22 };   
      this.Loaded += (s, e) =>   
 
    {   
        this.DataContext = this;               
      };   
  }   
public Person Person   
  {   
    get  
    {   
      return (person);   
    }   
  }   
  public bool NoErrors   
  {   
    get  
    {   
      return (errorCount == 0);   
    }   
  }   
  void FirePropertyChanged(string property)   
  {   
    if (PropertyChanged != null)   
    {   
      PropertyChanged(this, new PropertyChangedEventArgs(property));   
    }   
  }      
  private void OnValidationError(object sender, ValidationErrorEventArgs e)   
  {   
    switch (e.Action)   
    {   
      case ValidationErrorEventAction.Added:   
        errorCount++;   
        break;   
      case ValidationErrorEventAction.Removed:   
        errorCount--;   
        break;   
      default:   
        break;   
    }   
    FirePropertyChanged("NoErrors");   
  }   
  int errorCount;   
  Person person;   
  public event PropertyChangedEventHandler PropertyChanged;   
}

and most of that is really around having a NoErrors property to enable/disable the button – the bits around IDataErrorInfo are as they were in the DataGrid example with the one exception of using the new NotifyOnValidationError on the binding directive and that gives me a UI made up of TextBoxes with the validation display being pretty much the same;