• Home
  • About
  • BestBloggingIdeas
  • DotNetLearningSource
  • FORUM
  • Joblinks
  • Latest News
  • Policy
  • POSTS
  • SimplySqlServer.Com && SimplyAspDotNet.Com
  • Sitemap

Join Ours Forum

Asp.Net,C#,Ajax,Sql server,silverlight,Javascript codes exambles articles,Programming exambles

RSS Feed
  • Bounty Huge Roll [Amazon Frustration-Free Packaging]
  • XML Introduction to XML VHS Video Training, 1 hr., 32 minutes.
  • The Basic Overview of Windows Mobile Development Asp.Net C#
  • Overview of Sql server extended properties Asp.Net C#
  • How to Use Sql Server Extended properties using visual studio Asp.Net C#
  • Adobe Dreamweaver Templates Accelerate Web Development
  • Top Tips for Web Design Projects
  • How to Achieve a Good Web Design Structure
  • To Use Or Not To Use Website Templates
  • Five Tips to a Successful Website
  • Top 10 Articles,


    Silverlight Datagrid Select Update Delete Insert Asp.Net C#

    Differences Similarities Benefits Between Typed Datasets and Untyped Datasets asp.net c#

    Linq to Sql Introduction Entities Ado.Net C# SqlClasses Attributes Linq Mapping

    Linq Programming/How Linq Works?/Linq Implementation In Asp.Net C# Ado.Net

    Performing Developing Using Investigating Asp.Net 2.0 Ajax Application Development Asp.Net C#

    Hosting/Install Wcf Services in a Windows Service Asp.Net C#

    Connecting Silverlight to Wcf Asp.Net C#

    Silverlight Data Grid Data Binding WCF Asp.Net C#

    Invoking/Accessing/Calling WCF Service Without Adding/Creating Proxy/Reference Asp.Net C#

    Performing Doing Creating Insert Update Delete sql data Using Linq Database Asp.Net C#

    Creating/Developing Silverlight Data Driven Applications Using Wcf Linq Asp.Net C#

    Posted by on August 22, 2010 Leave a comment (5) Go to comments

    Introduction:
    In this article,i am going to demonstrate how to create a data driven applications using
    silverlight linq and wcf.

    Main:

    Open Visual Studio 2010 with the Silverlight 4 tools installed. Once inside the Integrated Development Environment (IDE), Go to File | New | Project…. In the New Project dialog that appears, select the Silverlight node under Visual C# and select Silverlight Application. Name the application as SilverlightEmployeeBrowser and click the OK button.
    13

    In the dialog that appears as shown in the next screenshot, select ASP.NET Web Application Project as the type of web project that will be used to host the Silverlight application. Also, make sure that Silverlight 4 is selected as the
    target version of Silverlight 4.
    23

    Right-click on SilverlightEmployeeBrowser.Web and select Add | New Item…. Add a Silverlight-enabled WCF Service by
    selecting the Silverlight node under Visual C# and name it as EmployeeService. Click the Add button. Two files are
    added, namely, EmployeeService.svc and EmployeeService.svc.cs.(Getting or Declaring Ours data manipulation here),
    32
    For ex in EmployeeService.svc.cs,

    using System;
    using System.IO;
    using System.Data;
    using System.Linq;
    using System.Collections.Generic;
    using System.Runtime.Serialization;
    using System.ServiceModel;
    using System.ServiceModel.Activation;
     
    namespace SilverlightEmployeeBrowser.Web
    {
        [ServiceContract(Namespace = "")]
        [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        public class EmployeeService
        {
            [OperationContract]
            public List<Employee> GetEmployees()
            {
                return new List<Employee>
        {
          new Employee
          {
            Name = "Peter",
            Salary = 100,
            Location = "Dallas",
            Country = "USA"
          },
          new Employee
          {
            Name = "Rouville Fisher",
            Salary = 200,
            Location = "London",
            Country = "United Kingdom"
          },
          new Employee
          {
            Name = "James",
            Salary = 15000,
            Location = "NY",
            Country = "USA"
          },
          new Employee
          {
     
            Name = "Marciya",
            Salary = 230,
            Location = "NPD",
            Country = "USA"
          }
        };
     
            }
            [DataContract]
            public class Employee
            {
                [DataMember]
                public string Name { get; set; }
                [DataMember]
                public string Location { get; set; }
                [DataMember]
                public string Country { get; set; }
     
                [DataMember]
                public double Salary { get; set; }
            }
        }
    }

    Next Right Click SilverlightEmployeeBrowser and select Add service reference and add Employeeservice we build,
    43
    Open MainPage.xaml and design it necessary,
    for ex,

    <UserControl x:Class="SilverlightEmployeeBrowser.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">
     
        <Grid x:Name="LayoutRoot" Width="400" Height="300"
          Background="SkyBlue">
            <Grid.RowDefinitions>
                <RowDefinition Height="50"></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <ComboBox x:Name="EmployeeComboBox" Width="250"
                SelectionChanged="EmployeeComboBox_SelectionChanged"
                DisplayMemberPath="Name"
                VerticalAlignment="Center">
            </ComboBox>
            <Grid x:Name="EmployeeDetailGrid" Grid.Row="1"
            VerticalAlignment="Top">
                <Grid.RowDefinitions>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock x:Name="NameTextBlock"
                   Grid.Row="0"
                   Grid.Column="0"
                   FontWeight="Bold"
                   Text="Name: "
                   HorizontalAlignment="Right">
                </TextBlock>
                <TextBlock x:Name="NameValueTextBlock"
                   Grid.Row="0"
                   Grid.Column="1"
                   Text="{Binding Name}">
                </TextBlock>
                <TextBlock x:Name="LocationTextBlock"
                   Grid.Row="1"
                   Grid.Column="0"
                   FontWeight="Bold"
                   Text="Location: "
                   HorizontalAlignment="Right">
     
                </TextBlock>
                <TextBlock x:Name="LocationValueTextBlock"
                   Grid.Row="1"
                   Grid.Column="1"
                   Text="{Binding Location}">
                </TextBlock>
                <TextBlock x:Name="CountryTextBlock"
                   Grid.Row="2"
                   Grid.Column="0"
                   FontWeight="Bold"
                   Text="Country: "
                   HorizontalAlignment="Right">
                </TextBlock>
                <TextBlock x:Name="CountryValueTextBlock"
                   Grid.Row="2"
                   Grid.Column="1"
                   Text="{Binding Country}">
                </TextBlock>
                <TextBlock x:Name="PriceTextBlock"
                   Grid.Row="3"
                   Grid.Column="0"
                   FontWeight="Bold"
                   Text="Salary: "
                   HorizontalAlignment="Right">
                </TextBlock>
                <TextBlock x:Name="SalaryValueTextBlock"
                   Grid.Row="3"
                   Grid.Column="1"
                   Text="{Binding Salary}">
                </TextBlock>
            </Grid>
        </Grid>
     
    </UserControl>

    In MainPage.xaml.cs,

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
     
    namespace SilverlightEmployeeBrowser
    {
        public partial class MainPage : UserControl
        {
            public MainPage()
            {
                InitializeComponent();
                EmployeeService.EmployeeServiceClient EmpClient = new EmployeeService.EmployeeServiceClient();
                EmpClient.GetEmployeesCompleted +=new EventHandler<EmployeeService.GetEmployeesCompletedEventArgs>(EmpClient_GetEmployeesCompleted);
                EmpClient.GetEmployeesAsync();
            }
     
            void EmpClient_GetEmployeesCompleted(object sender,EmployeeService.GetEmployeesCompletedEventArgs e)
            {
                EmployeeComboBox.ItemsSource = e.Result;
            }
     
     
                private void EmployeeComboBox_SelectionChanged(object sender,
              SelectionChangedEventArgs e)
                    {
                      EmployeeDetailGrid.DataContext = (sender as ComboBox)
                        .SelectedItem as EmployeeService.EmployeeServiceEmployee;
                    }
     
     
        }
    }

    Build it and run it thatsit!
    55

    Conclusion:
    Please use forum for further more doubts/discussion/queries for this article
    Happy coding.

    Join the forum and make money by posting answers or discussing various topics here !

    ASP.NET
    ← Deploying Manually Publish XBAP Wpf Browser Application in IIS Asp.Net C# XAML
    Accessing Executing Running Stored Procedure/Function/Package Using Linq Silverlight Xaml →

    Learn Easily Using Video Tutorials


    How to choose the right Java IDE – explained Eclipse NetBeans BlueJ

    Developing/Creating/Performing/Configuring Java Applications Using Eclipse IDE

    Step By Step Guide for Download/Install Configure Eclipse IDE for Java

    Editing data with the GridView control Asp.Net C#

    Registering/Configuring Web Controls globally in web.config file asp.net c#

    Registering/Configuring Web Controls globally in web.config file asp.net c#

    Best way to prepare asp.net Interview - Success Stories

    Download Important Questions and PPT's:

    Sql Server Important Questions Online free download

    Dotnet Important Questions Online free download

    Exploring Linq to Sql Process Flow

    Learn how to perform silverlight programming

    Learn OOPs concepts in better and well manner

    Learn Ajax in better and well manner

    Leave a comment

    5 Comments.

    1. Tyson F. Gautreaux August 23, 2010 at 8:09 pm

      Thankful i recently found this amazing site, will make sure to save it so i can look at often.

    2. Carmen December 2, 2010 at 10:42 am

      When I try to add the service it gives me an error

    3. chandru December 2, 2010 at 5:16 pm

      for me the above code is working fine,can you please post here what error you got?

    4. pell grants December 13, 2010 at 12:37 am

      Wow this is a great resource.. I’m enjoying it.. good article

    5. desene animate March 12, 2011 at 12:52 am

      Very useful information. I appreciate your effort, very well written article.

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    *

    *


    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    Enter your email address:

    Delivered by FeedBurner

    • Recent Posts

      • Bounty Huge Roll [Amazon Frustration-Free Packaging]
      • XML Introduction to XML VHS Video Training, 1 hr., 32 minutes.
      • The Basic Overview of Windows Mobile Development Asp.Net C#
      • Overview of Sql server extended properties Asp.Net C#
      • How to Use Sql Server Extended properties using visual studio Asp.Net C#
    • Search by Tags!

      Application AspNet Basic between Black Bluetooth Build Business Collection Consultants Design Development Downloading effective Excel Experts Generics Implement Installing Interview Logic Management Microsoft Minutes Object Outlook Professional Programmer Programming Project Projects Questions Ready Select Server Services Silverlight Source Strings Studio Through using Visual Website Wordpress
    • Archives

      • August 2011
      • June 2011
      • May 2011
      • April 2011
      • March 2011
      • February 2011
      • December 2010
      • November 2010
      • October 2010
      • September 2010
      • August 2010
      • July 2010
      • June 2010
      • May 2010
      • April 2010
      • March 2010
      • February 2010
      • January 2010
      • December 2009
      • November 2009
      • October 2009
      • September 2009

    Copyright © 2012 NetProgrammingHelp.com

    Δ Top