European Silverlight Hosting BLOG

BLOG about Latest Silverlight Hosting and Its Techologies - Dedicated to European Windows Hosting Customer

Silverlight 5 Hosting Germany - HostForLIFE.eu :: How to access controls in DataGrid TemplateColumn header?

clock June 12, 2014 08:36 by author Peter

A data grid view is a rectangular control made of columns and rows. I have a DataGrid where I have included some controls in column header. Each column is a Template column. These controls appear just below the column header which are used for entering filter information. Here's the issue on my code on Silverlight 5.

VisualTreeHelper class helps to iterate through the visual tree of the xaml. Using it we can find the child and parent controls of the rendered controls. Lets check the Visual Tree of the rendered control using Silverlight Spy.

The Following Method do a search over the child controls with in a control recursively and returns the control based on Name.

private object GetChildControl(DependencyObject parent, string controlName)


    Object tempObj = null;
    int count = VisualTreeHelper.GetChildrenCount(parent);
    for (int counter = 0; counter < count; counter++)
    {
        //Get The Child Control based on Index
        tempObj = VisualTreeHelper.GetChild(parent, counter);
        //If Control's name Property matches with the argument control
        //name supplied then Return Control
        if ((tempObj as DependencyObject).GetValue(NameProperty).ToString() == controlName)
            return tempObj;
        else //Else Search Recursively
        {
            tempObj = GetChildControl(tempObj as DependencyObject, controlName);
            if (tempObj != null)
                return tempObj;
        }
    }
    return null;
}

Make sure that the same has to be delegated to UI thread using Dispatcher.As the controls created using UI Thread can not be accessed from other thread.
//Access the Grid Header Controls
Dispatcher.BeginInvoke(delegate
{
    var hyperlinkControl = GetChildControl(dataGrid1, "hlSort");
    var checkControl = GetChildControl(dataGrid1, "chkSelectAll");
});



HostForLIFE.eu Announces Release of Cheap Dedicated Windows Cloud Server Hosting Plans

clock June 3, 2014 09:08 by author Peter

European leading web hosting provider, HostForLIFE.eu announced cheap dedicated Windows cloud server due to high demand of Windows cloud server users in Europe.

Windows & ASP.NET hosting provider HostForLIFE.eu announced cheap dedicated Windows cloud server hosting plans. HostForLIFE.eu offers the ultimate performance and flexibility at an economical price for windows cloud server. HostForLIFE.eu cheap dedicated Windows cloud server hosting plans starts from just as low as €16.00/month only.

HostForLIFE.eu provisions all dedicated Windows Cloud Server in just few minutes (upon payment verification and completion). HostForLIFE.eu has a very strong commitment to introduce their Cheap dedicated Windows and ASP.NET Cloud Server hosting service to the worldwide market. HostForLIFE.eu starts to target market in Europe. HostForLIFE.eu will be the one-stop cheap dedicated Windows and ASP.NET Cloud Server Hosting Solution for every ASP.NET enthusiast and developer.

HostForLIFE’s cheap dedicated Windows Dedicated Cloud Server hosting plan comes with the following features: Windows 2008R2/2012, Data Center OS Version, 1 x vCPU, 1 GB RAM, You have full root access to the server 24/7/365, 40 GB Storage (SSD), 1000 GB Bandwidth, 1000 Mbps Connection, 1 Static IP and SAN Storage.

For additional information on this cheap Windows dedicated cloud server Hosting plan, please visit http://hostforlife.eu/European-Cheap-Windows-Cloud-Server-Plans

About HostForLIFE.eu:
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. HostForLIFE.eu deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

HostForLIFE.eu is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft (see www.microsoft.com/web/hosting/HostingProvider/Details/953). Their service is ranked the highest top #1 spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and other European countries. Besides this award, they have also won several awards from reputable organizations in the hosting industry and the detail can be found on their official website.



HostForLIFE.eu offers €1.29/month Affordable and High Performance Windows & ASP.NET Shared Hosting Plan

clock May 20, 2014 11:53 by author Peter

European Windows and ASP.NET hosting specialist, HostForLIFE.eu, has officially launched the new Windows & ASP.NET Shared Hosting Plan offered from as low as €1.29/month only. This LITE Windows & ASP.NET Hosting packages combine generous or 1 website, 1 GB disk space, 10 GB bandwidth, Support UTF-8 Domains, Dedicated Pool, etc. As the market for hosted solutions continues to grow, the new hosting range is designed to exceed the growing technical demands of businesses and IT professionals.

HostForLIFE.eu  is confident that their new LITE shared hosting plans will surely appeal to the personal across the world, besides the website owners and companies owning websites. The new web hosting plans will meet the requirement of high performance web hosting where one can easily update the content of a website on a regular basis. This plan is designed more for the web hobbiest needing affordable, high availability, hosting and easy backend management of windows and ASP.NET with powerful Plesk control panel.

Every day thousands of people decide to set up a website for business or personal use. New business owners and the average consumer don’t always have access to unlimited budgets. HostForLIFE.eu understand the importance of reliable hosting but are not always prepared to pay the exorbitant prices that reliable hosts charge.

For additional information about LITE Shared Hosting Plan offered by HostForLIFE.eu, please visit http://hostforlife.eu

About HostForLIFE.eu:

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. HostForLIFE.eu  deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

HostForLIFE.eu is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft (see www.microsoft.com/web/hosting/HostingProvider/Details/953). Their service is ranked the highest top #1 spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and other European countries. Besides this award, They have also won several awards from reputable organizations in the hosting industry and the detail can be found on their official website.



HostForLIFE.eu Proudly Announces Microsoft SQL Server 2014 Hosting

clock April 7, 2014 11:09 by author Peter
HostForLIFE.eu was established to cater to an under served market in the hosting industry; web hosting for customers who want excellent service. HostForLIFE.eu a worldwide provider of hosting has announced the latest release of Microsoft's widely-used SQL relational database management system SQL Server Server 2014. You can take advantage of the powerful SQL Server Server 2014 technology in all Windows Shared Hosting, Windows Reseller Hosting and Windows Cloud Hosting Packages! In addition, SQL Server 2014 Hosting provides customers to build mission-critical applications and Big Data solutions using high-performance, in-memory technology across OLTP, data warehousing, business intelligence and analytics workloads without having to buy expensive add-ons or high-end appliances. 

SQL Server 2014 accelerates reliable, mission critical applications with a new in-memory OLTP engine that can deliver on average 10x, and up to 30x transactional performance gains. For Data Warehousing, the new updatable in-memory column store can query 100x faster than legacy solutions. The first new option is Microsoft SQL Server 2014 Hosting, which is available to customers from today. With the public release just last week of Microsoft’s latest version of their premier database product, HostForLIFE has been quick to respond with updated their shared server configurations.For more information about this new product, please visit http://hostforlife.eu/European-SQL-Server-2014-Hosting

About Us:
HostForLIFE.eu is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft (see http://www.microsoft.com/web/hosting/HostingProvider/Details/953). Our service is ranked the highest top #1 spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and other European countries. Besides this award, we have also won several awards from reputable organizations in the hosting industry and the detail can be found on our official website.


FREE Silverlight 5 Spain Hosting - HostForLIFE.eu :: Silverlight: Updating the XAP Configuration Programmatically

clock March 20, 2014 08:16 by author Peter

One of the bigger annoyances dealing with programming in Silverlight 5 is the deployment of XAP files. In order to properly update a XAP file you typically:

1. Rename XAP file to a ZIP file.

2. Extract the ServiceReferences.ClientConfig file.

3. Update the configuration file with the proper IP information.

4. Update the ZIP file and save.

5. Rename ZIP file back to XAP.

So, how do we do that with code so we can skip this frustration? Let’s first look at a few factors:

We are using the .Net 4.0 Framework. Don’t bother using System.IO.Packaging.ZipPackage. It thinks XAP files are always corrupt. It’s annoying. We are just updating the IP information. First, let’s look at how we update the configuration file if it was committed to a MemoryStream. In this snippet we:

1. Grab all the contents from the MemoryStream.

2. Replace the IP information in the content.

3. Clear the MemoryStream.

4. Overwrite the stream contents with the new content.

5. Reset the position in the stream to 0.

/// <summary>
/// Updates the configuration file
/// </summary>
/// <param name="stream">The stream.</param>
/// <param name="replacementIp">The replacement ip.</param>
/// <param name="destinationIp">The destination ip.</param>
/// <returns></returns>
private bool UpdateConfigurationFile(MemoryStream stream,
    string replacementIp, string destinationIp)
{
    bool isSuccessful = false;
    try
    {
        // Read current file
        var reader = new StreamReader(stream);
        stream.Position = 0;
        var contents = reader.ReadToEnd();       
        // Update IP information
        var newContents = contents.Replace(replacementIp, destinationIp);
        // Reset contents of stream
        stream.SetLength(0);
        // Overwrite original configuration file
        var writer = new StreamWriter(stream);
        writer.Write(newContents);
        writer.Flush();
        // Set position in stream to 0.
        // This allows us to start writing from the beginning of the stream.
        stream.Seek(0, SeekOrigin.Begin);
        // Success
        isSuccessful = true;
    }
    catch (Exception)
    {
    }
    // return
    return isSuccessful;
}

Our main method below does this:

- Extract the ServiceReferences.ClientConfig file.
- Call the UpdateConfigurationFile method above to revise the IP information.
-  Update the ZIP file and commit the changes.
/// <summary>
/// Updates the silverlight configuration file.
/// </summary>
/// <param name="configFileName">Name of the config file.</param>
/// <param name="xapFilePath">The xap file path.</param>
/// <param name="replacementIp">The replacement ip.</param>
/// <param name="destinationIp">The destination ip.</param>
/// <returns></returns>
private bool UpdateSilverlightConfigurationFile(string configFileName,
    string xapFilePath, string replacementIp, string destinationIp)
 {
    // Check file path
    if (!File.Exists(xapFilePath)) { return false; }
    // Open XAP and modify configuration
   using (var zip = ZipFile.Read(xapFilePath))
    {
        // Get config file
        var entry = zip[configFileName];
        var stream = new MemoryStream();
        entry.Extract(stream);
        // Manipulate configuration
        var updated =
            UpdateConfigurationFile(stream, replacementIp, destinationIp);
        // Evaluate
        if (updated)
        {
            // Replace existing configuration file in XAP
            zip.UpdateEntry(configFileName, stream);
            zip.Save();
        }
    }
    // return
    return true;
}

So, let’s look at the code in it’s entirety so that we get an implementation example as well as the needed includes:
using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using Ionic.Zip;
namespace XAPFileUpdaterTest
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            // Intialize UI
            InitializeComponent();
            // Parameters
            string configFile = "ServiceReferences.ClientConfig";
            string xap = @"MyAwesomeApp.xap";
            string replacementIp = "127.0.0.1";
            string destinationIp = "12.23.45.67";
             // Check
            var isClientConfigUpdated =
                UpdateSilverlightConfigurationFile(
                   configFile, xap, replacementIp, destinationIp); 
            // Setup message
            var message =
                (isClientConfigUpdated) ? "was successful" : "failed"; 
            // Notify user
            MessageBox.Show("The current update " + message);
        }
        /// <summary>
        /// Updates the configuration file.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <param name="replacementIp">The replacement ip.</param>
        /// <param name="destinationIp">The destination ip.</param>
        /// <returns></returns>
        private bool UpdateConfigurationFile(MemoryStream stream,
            string replacementIp, string destinationIp)
        {
            bool isSuccessful = false;
           try
            {
                // Read current file
                var reader = new StreamReader(stream);
                stream.Position = 0;
                var contents = reader.ReadToEnd();
                // Update IP information
                var newContents = contents.Replace(replacementIp, destinationIp);
                // Reset contents of stream
                stream.SetLength(0);
                // Overwrite original configuration file
                var writer = new StreamWriter(stream);
                writer.Write(newContents);
                writer.Flush();
                // Set position in stream to 0.
                // This allows us to start writing from the beginning of the stream.
                stream.Seek(0, SeekOrigin.Begin);
                // Success
                isSuccessful = true;
            }
            catch (Exception)
            {
            }
            // return
            return isSuccessful;
        }
        /// <summary>
        /// Updates the silverlight configuration file.
        /// </summary>
        /// <param name="configFileName">Name of the config file.</param>
        /// <param name="xapFilePath">The xap file path.</param>
        /// <param name="replacementIp">The replacement ip.</param>
        /// <param name="destinationIp">The destination ip.</param>
        /// <returns></returns>
        private bool UpdateSilverlightConfigurationFile(string configFileName,
            string xapFilePath, string replacementIp, string destinationIp)
        {
            // Check file path
            if (!File.Exists(xapFilePath)) { return false; } 
            // Open XAP and modify configuration
            using (var zip = ZipFile.Read(xapFilePath))
            {
                // Get config file
                var entry = zip[configFileName];
               var stream = new MemoryStream();
                entry.Extract(stream);
                // Manipulate configuration
                var updated =
                    UpdateConfigurationFile(stream, replacementIp, destinationIp);
                // Evaluate
                if (updated)
                {
                    // Replace existing configuration file in XAP
                    zip.UpdateEntry(configFileName, stream);
                    zip.Save();
                }
            }
           // return
            return true;
        }
    }
}

That’s all for now. I hope I helped you with this annoyance.



Silverlight Italy Hosting - HostForLIFE.eu :: Silverlight Control Size and Browser Resize Problem

clock March 10, 2014 10:21 by author Peter

Sometime if Silverlight control have a bigger size than it create some problems. If browser is smaller than Silverlight control then some part of SL control get clipped. In this scenario sometime you want to get scrollbar some time you want to change SL control height according to browser.

There are some different scenario that how people want to embed there Silverlight control in there page

1. If Silverlight Control is long then it should be in scrollbar.

2. Silverlight control should filled whole page in width and height without caring of height – width ratio.

3. Silverlight control should filled page with maintaining aspect ratio.

Silverlight Control is long then it should be in scrollbar

If your Silverlight control height is fixed assume its 800px and width is 900px then you should define this in your user control in this way :

<UserControl x:Class=”Slider.Page” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;  
 xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;  
 Width=”700″ Height=”800″ xmlns:d=”http://schemas.microsoft.com/expression/blend/2008&#8243; xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006&#8243; mc:Ignorable=”d”>  
 <Grid x:Name=”LayoutRoot” Background=”White”>  
 </Grid>  
 </UserControl>   

and in aspx page it should be

<div id=”silverlightControlHost” style=”width:700;height:800; “>  

it will give you scrollbar.

Silverlight control should filled whole page in width and height without caring of height – width ratio

In this case you need put your layout in Canvas instead of Grid and add transforms in that way:

<UserControl x:Class=”SlSizeChange.Page” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;  
 xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221; Height=”Auto” Width=”Auto” Background=”#FF29D530″ HorizontalAlignment=”Stretch” VerticalAlignment=”Stretch” >  
 <Canvas HorizontalAlignment=”Center” x:Name=”Layout” Width=”930″ Height=”640″ VerticalAlignment=”Center” RenderTransformOrigin=”0.5,0.5″ Background=”#FFB9B839″>  
 <Canvas.RenderTransform>  
    <TransformGroup>  
       <ScaleTransform ScaleX=”1″ ScaleY=”1″ x:Name=”LayoutScale” />  
      <SkewTransform />  
      <RotateTransform />  
      <TranslateTransform />  
   </TransformGroup>  
 </Canvas.RenderTransform>  
 <TextBlock Height=”75″ Width=”276″ Canvas.Left=”71″ Canvas.Top=”18″ Text=”TextBlock” TextWrapping=”Wrap”/>  
 <TextBlock Height=”77″ Width=”140″ Canvas.Left=”248″ Canvas.Top=”341″ Text=”TextBlock” TextWrapping=”Wrap”/>  
 <TextBlock Height=”64″ Width=”69″ Canvas.Left=”365″ Canvas.Top=”509″ Text=”TextBlock” TextWrapping=”Wrap”/>  
 <TextBlock Height=”52″ Width=”125″ Canvas.Left=”652″ Canvas.Top=”525″ Text=”TextBlock” TextWrapping=”Wrap”/>  
 </Canvas>  
 </UserControl>  

Then attach sizeChanged event handler

public partial class Page : UserControl  
  {  
     public Page()  
     {  
      InitializeComponent();  
      this.SizeChanged += new SizeChangedEventHandler(Layout_SizeChanged);  
     }  
     void Layout_SizeChanged(object sender, SizeChangedEventArgs e)  
    {  
      LayoutScale.ScaleX = e.NewSize.Width / (Layout.Width);  
     LayoutScale.ScaleY = e.NewSize.Height / (Layout.Height);  
    }   
 }  

Silverlight control should filled page with maintaining aspect ratio

Now third case where you want to maintain your width – height aspect ratio.To achieve this follow last process in same way with a small difference:

<UserControl x:Class=”SlSizeChange.Page”  
 xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;  
 xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221; Height=”Auto” Width=”Auto” Background=”#FF29D530″ HorizontalAlignment=”Stretch” VerticalAlignment=”Stretch” >  
 <Canvas HorizontalAlignment=”Center” x:Name=”Layout” Width=”930″ Height=”640″ VerticalAlignment=”Top” RenderTransformOrigin=”0.5,0″ Background=”#FFB9B839″>  
 <Canvas.RenderTransform>  
   <TransformGroup>  
     <ScaleTransform ScaleX=”1″ ScaleY=”1″ x:Name=”LayoutScale” />  
     <SkewTransform />  
     <RotateTransform />  
     <TranslateTransform />  
   </TransformGroup>  
 </Canvas.RenderTransform>  
 <TextBlock Height=”75″ Width=”276″ Canvas.Left=”71″ Canvas.Top=”18″ Text=”TextBlock” TextWrapping=”Wrap”/>  
 <TextBlock Height=”77″ Width=”140″ Canvas.Left=”248″ Canvas.Top=”341″ Text=”TextBlock” TextWrapping=”Wrap”/>  
 <TextBlock Height=”64″ Width=”69″ Canvas.Left=”365″ Canvas.Top=”509″ Text=”TextBlock” TextWrapping=”Wrap”/>  
 <TextBlock Height=”52″ Width=”125″ Canvas.Left=”652″ Canvas.Top=”525″ Text=”TextBlock” TextWrapping=”Wrap”/>  
 </Canvas>  
 </UserControl>  
 And for C#  
 public partial class Page : UserControl  
 {  
    public Page()  
    {     InitializeComponent();  
      this.SizeChanged += new SizeChangedEventHandler(Layout_SizeChanged);  
     }   
    void Layout_SizeChanged(object sender, SizeChangedEventArgs e)  
    {  
     double aspectRatio = e.NewSize.Width / e.NewSize.Height;  
     if (aspectRatio < (Layout.Width / Layout.Height))  
      LayoutScale.ScaleX = LayoutScale.ScaleY = e.NewSize.Width / (Layout.Width);  
     else  
      LayoutScale.ScaleX = LayoutScale.ScaleY = e.NewSize.Height / (Layout.Height);  
    }   
 }  

Now this will always maintain the aspect ratio.



Silvelight Germany Hosting - HostForLIFE.eu :: How To Clear Silverlight Cache

clock March 5, 2014 07:12 by author Peter

I recently had an issue where a Silverlight application was acting up on me. It was an application that I was using, not one I’d developed and I really didn’t have much experience with Silverlight at that point. It was working for other people and other browsers on my computer were experiencing the same problem. I’d already cleared the Internet cache multiple times including cookies and other stuff. I applied all the latest patches, hot fixes and service packs as well as updated my browsers to the latest versions. I finally came to the point where I updated Silverlight thinking it could be related to Silverlight itself. None of this solved the problem.

Finally another developer alerted me to the possibility of clearing the Silverlight cache. Now don’t laugh, but I didn’t know that Silverlight had its own cache. I looked online for quite a while on how to clear the Silverlight cache but came up empty. So, I went looking myself. Here’s how you do it.

Clear Silverlight Cache

1. Open the Microsoft Silverlight shortcut in your start menu. Depending on what version and how you manage your Start Menu, this could be in various places. You could also just click Run or browse to ”C:\Program Files\Microsoft Silverlight\{VERSION}\Silverlight.Configuration.exe” where {VERSION} equals the version you have installed. For me, as of writing this article, it was 5.1.20125.0.

2. You will see the Microsoft Silverlight Configuration application come up.

3. Click on the Application Storage tab and you will see tab contents like this.

4. Click on a web site you want to clear from cache and click the Delete button, or click the Delete all button to clear all web site data from cache.

5. Click OK

Congratulations! You’ve just cleared the Microsoft Silverlight cache on your system.



HostForLIFE.eu Proudly Announces ASP.NET MVC 5.1.1 Hosting

clock February 28, 2014 11:07 by author Peter

European Recommended Windows and ASP.NET Spotlight Hosting Partner in Europe, HostForLIFE.eu, has announced the availability of new hosting plans that are optimized for the latest update of the Microsoft ASP.NET MVC 5.1.1 technology.  HostForLIFE.eu - a cheap, constant uptime, excellent customer service, quality and also reliable hosting provider in advanced Windows and ASP.NET technology. They proudly announces the availability of the ASP.NET MVC 5.1.1 hosting in their entire servers environment.

HostForLIFE.eu hosts its servers in top class data centers that is located in Amsterdam to guarantee 99.9% network uptime. All data center feature redundancies in network connectivity, power, HVAC, security, and fire suppression. All hosting plans from HostForLIFE.eu include 24×7 support and 30 days money back guarantee. You can start hosting your ASP.NET MVC 5.1.1 site on their environment from as just low €3.00/month only.

ASP.NET MVC 5.1.1  is the latest update to Microsoft's popular MVC (Model-View-Controller) technology - an established web application framework. MVC enables developers to build dynamic, data-driven web sites. ASP.NET MVC 5.1.1 adds sophisticated features. ASP.NET MVC 5.1.1  gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and that gives you full control over markup. For additional information about ASP.NET MVC 5.1.1 Hosting offered by HostForLIFE.eu, please visit http://hostforlife.eu/European-ASPNET-MVC-511-Hosting

About HostForLIFE.eu

HostForLIFE.eu is an European Windows Hosting Provider which focuses on the Windows Platform only. HostForLIFE.eu deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.



Silverlight 5 Hosting - Performing Create, Read, Update, Delete using Silverlight 5 with WCF RIA Services

clock February 27, 2014 07:02 by author Peter

In this article let’s play around with one of the most useful concept CRUD using Silverlight 5 with WCF RIA Services. Well, What is CRUD using Silverlight 5 with WCF RIA Services? In Simple terms “Performing CRUD operation using Silverlight 5 with WCF RIA Services”

Step 1: Create a new Silverlight application

Check Enable WCF RIA Services in New Silverlight Application window as shown below:

Step 2: Adding New Entity Data Model Framework

Step 3: Adding New Domain Service

Step 4: The complete code of Main.XAML looks as below

</p>
<UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="CRUDviaRIAStoredProc.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="600" d:DesignWidth="650">
 
<Grid x:Name="LayoutRoot" Background="White">
 <TextBlock Height="23" HorizontalAlignment="Left" Margin="148,42,0,0" Name="textBlock5" Text="EmployeeId" FontFamily="Verdana" FontSize="15" VerticalAlignment="Top"/>
 <TextBox Height="23" HorizontalAlignment="Left" Margin="248,42,0,0" Name="textBox5" VerticalAlignment="Top" Width="120"/>
 <TextBlock Height="23" HorizontalAlignment="Left" Margin="148,82,0,0" Name="textBlock1" Text="FirsName" FontFamily="Verdana" FontSize="15" VerticalAlignment="Top"/>
 <TextBox Height="23" HorizontalAlignment="Left" Margin="248,78,0,0" Name="textBox1" VerticalAlignment="Top" Width="120"/>
 <TextBlock Height="23" HorizontalAlignment="Left" Margin="148,121,0,0" Name="textBlock2" Text="LastName" FontFamily="Verdana" FontSize="15" VerticalAlignment="Top"/>
 <TextBox Height="23" HorizontalAlignment="Left" Margin="248,121,0,0" Name="textBox2" VerticalAlignment="Top" Width="120"/>
 <TextBlock Height="23" HorizontalAlignment="Left" Margin="148,166,0,0" Name="textBlock3" Text="Age" FontFamily="Verdana" FontSize="15" VerticalAlignment="Top"/>
 <TextBox Height="23" HorizontalAlignment="Left" Margin="248,166,0,0" Name="textBox3" VerticalAlignment="Top" Width="120"/>
 <TextBlock Height="23" HorizontalAlignment="Left" Margin="148,206,0,0" Name="textBlock4" Text="Location" FontFamily="Verdana" FontSize="15" VerticalAlignment="Top"/>
 <TextBox Height="23" HorizontalAlignment="Left" Margin="248,206,0,0" Name="textBox4" VerticalAlignment="Top" Width="120"/>
 <Button Content="ReadData" FontFamily="Verdana" FontSize="15" Background="DeepSkyBlue" Height="34" HorizontalAlignment="Left" Margin="148,249,0,0" Name="button1" VerticalAlignment="Top" Width="80" Click="button1_Click"/>
 <Button Content="Insert" FontFamily="Verdana" FontSize="15" Background="DeepSkyBlue" Height="34" HorizontalAlignment="Left" Margin="246,249,0,0" Name="button2" VerticalAlignment="Top" Width="80" Click="button2_Click"/>
 <Button Content="Update" FontFamily="Verdana" FontSize="15" Background="DeepSkyBlue" Height="34" HorizontalAlignment="Left" Margin="346,249,0,0" Name="button3" VerticalAlignment="Top" Width="80" Click="button3_Click"/>
 <Button Content="Delete" FontFamily="Verdana" FontSize="15" Background="DeepSkyBlue" Height="34" HorizontalAlignment="Left" Margin="446,249,0,0" Name="button4" VerticalAlignment="Top" Width="80" Click="button4_Click"/>
 <sdk:DataGrid Height="216" HorizontalAlignment="Left" Margin="146,310,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="380"/>
 </Grid>
</UserControl>
<p style="text-align: justify;">


Step 5: The complete code of Main.XAML.cs looks as below

</p>
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;
using CRUDviaRIAStoredProc.Web;
 
namespace CRUDviaRIAStoredProc
{
 public partial class MainPage : UserControl
 {
 # region Service Instance
 CompanyDomainContext ctx = new CompanyDomainContext();
 #endregion
 
public MainPage()
 {
 InitializeComponent();
 }
 
private void button1_Click(object sender, RoutedEventArgs e)
 {
 ctx.Load<tblEmployee>(ctx.GetTblEmployeesQuery(), (lo) => { dataGrid1.ItemsSource = lo.Entities; }, false);
 }
 
private void button2_Click(object sender, RoutedEventArgs e)
 {
 ctx.InsertEmp(textBox1.Text, textBox2.Text, Convert.ToInt32(textBox3.Text), Convert.ToInt32(textBox4.Text));
 MessageBox.Show("Data Inserted Succesfully");
 }
 
private void button3_Click(object sender, RoutedEventArgs e)
 {
 ctx.UpdateEmp(Convert.ToInt32(textBox5.Text), textBox1.Text, textBox2.Text, Convert.ToInt32(textBox3.Text));
 MessageBox.Show("Data Updated Succesfully");
 }
 
private void button4_Click(object sender, RoutedEventArgs e)
 {
 ctx.DeleteEmp(Convert.ToInt32(textBox5.Text));
 MessageBox.Show("Employee deleted Succesfully");
 }
 }
}
<p style="text-align: justify;">


European HostForLIFE.eu Proudly Launches Windows Server 2012 R2 Hosting

clock February 17, 2014 10:21 by author Peter

HostForLIFE.eu proudly launches the support of Windows Server 2012 R2 on all their newest Windows Server environment. On Windows Server 2012 R2 hosted by HostForLIFE.eu, you can try their new and improved features that deliver extremely high levels of uptime and continuous server availability start from €3.00/month.

Microsoft recently released it’s latest operating system Windows Server 2012 R2 to global customers. Microsoft Windows Server 2012 R2 is much more than just another service pack; adding new features that make it easier to build cloud applications and services in your datacenter.

Delivering on the promise of a modern datacenter, modern applications, and people-centric IT, Windows Server 2012 R2 provides a best-in-class server experience that cost-effectively cloud-optimizes your business. When you optimize your business for the cloud with Windows Server 2012 R2 hosting, you take advantage of your existing skillsets and technology investments.

You also gain all the Microsoft experience behind building and operating private and public clouds – right in the box. Windows Server 2012 R2 offers an enterprise-class, simple and cost-effective solution that’s application-focused and user centric.

Further information and the full range of features Windows Server 2012 R2 Hosting can be viewed here: http://hostforlife.eu/European-Windows-Server-2012-R2-Hosting

About Company
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. HostForLIFE.eu deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.



About HostForLIFE

HostForLIFE is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2019 Hosting, ASP.NET 5 Hosting, ASP.NET MVC 6 Hosting and SQL 2019 Hosting.


Tag cloud

Sign in