RIA Services in Silverlight 4 Using VS 2010

No.of Views1066
Bookmarked0 times
Downloads 
Votes0
By  dpatra   On  16 May 2010 06:05:52
Tag : Silver Light and XAML , General
we will see how we can filter a Textbox on Keyboard inputs. We will see how we can block Numeric input from Keyboard.
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

In this article we will see how we can filter a Textbox on Keyboard inputs. We will see how we can block Numeric input from Keyboard.

Creating Silverlight Project

Fire up Visual Studio 2010 and create a new Silverlight 4 Business Application Project. Name it as RIASilverlight4Sample01. 

Image Loading

After creating the Project, you would see a change in Solution Structure. I meant to say that different Layers are separated from each other using different Folders.
See the below figure for the Solution Structure in VS 2010.

 

Image Loading

We will have our own Page to the Project. Add A Silverlight Page to the “View” Folder, name it as Employee.xaml.

 

Image Loading

I have added the below XAML code to have the link button in the MainPage.xaml
 

Image Loading

We would add a DataGrid to the Employee.xaml page which will be useful for our need.Now Add An Entity Model to the Web Project. 

Image Loading

The following screenshots are for the reference how to proceed further. You can use it as step by step.
 

Image Loading
Image Loading
Image Loading
Image Loading
Image Loading
Image Loading

We would change the table and field names for easy use.

Image Loading

Add A Domain Service Class to the Web project and name it as “EmployeeDomainService”. 

Image Loading
Image Loading

If you are not getting any Entity Frameworks listed, then just press cancel and rebuild the Web Project. And do the above steps again.You would see the EmployeeDomainService.cs file has all the methods related to CRUD operations. See the below figure.

Image Loading

Change the GetEmployees method to below code. 

Image Loading

Now Re Build the solution.Building the solution generates the Domain Context and entities in the client project.Open Employee.xaml.cs and add the following namespaces.
 

Image Loading

Add the following Context and use it as shown below 

Image Loading

I have changed the DataGrid’s AutoGenerateColumns to False and made the IsReadOnly property to True. I have customized the columns structure as follows: 

Image Loading

Now we are ready, run the application and click on the Employee Details Link on the top right. You would get the results as shown in below figure. 

Image Loading

Hope this article helps for the beginning.

Sample Project Source

Download source files -2443 kb

 
Sign Up to vote for this article
 
About Author
 
dpatra
Occupation-Not Provided
Company-Not Provided
Member Type-Expert
Location-Not Provided
Joined date-13 Jul 2009
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
    In this article we’ll have a brief introduction to Microsoft Silverlight, see how it fits with other technologies today, and watch it in action. Get ready!
    Published Date : 05/May/2011
    When you start learning Silverlight and create your first Silverlight application, one thing you will notice XAP file along with HTML and ASPX files. First time after running your Silverlight application you can see XAP file in client bin folder. Before running of Silverlight application, you will not find XAP file in client bin folder.
    Published Date : 19/Apr/2011
    In this article, i will explain how to download or read file asynchronously using WebClient class in Silverlight.The WebClient class is a has many methods,events and properties to support download files in different ways.
    Published Date : 16/Apr/2011
    This article will give a basic introduction of behavior feature in SILVERLIGHT3.0. I will also walkthrough to create a custom behavior.
    Published Date : 05/Apr/2010
    In this article we would see how we can use ADO.NET Entity Data Model as the ORM in Silverlight 3 Application, and ADO.NET Data Service to fetch the data.
    Published Date : 20/Apr/2010
Comments
By:Chinna SrihariDate Of Posted:7/5/2010 8:49:48 PM
RIA Services in Silverlight 4 Using VS 2010
Hi, The context of the artical is not correct. Title --> RIA Services in Silverlight 4 Using VS 2010 Introduction --> "In this article we will see how we can filter a Textbox on Keyboard inputs. We will see how we can block Numeric input from Keyboard." Output --> Finally the out come is different and is just sortby. Chinna
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top