Full Trust European Hosting

BLOG about Full Trust Hosting and Its Technology - Dedicated to European Windows Hosting Customer

Angular.js Hosting UK - HostForLIFE.eu :: Double Click Event in AngularJS

clock March 30, 2015 09:06 by author Peter

This article explains double-click events in AngularJS. we've already explained mouse events exploitation AngularJS in my previous article Mouse Events exploitation AngularJS. currently during this article i'm explaining the ng-dblclick directive of AngularJS.

ng-dblclick
This allows you to specify custom behaviour on a double-click event of the mouse on the web page. we will use it (ng-dblclick) as an attribute of the HTML component like:
<ANY_HTML_ELEMENT  ng-dblclick="{expression}">  
  ...  
</ANY_HTML_ELEMENT>

Use the subsequent procedure to make a sample of a double-click event using AngularJS. First of all, you would like to add an external Angular.js file to your application, for this you'll be able to visit the AngularJS official website or transfer my source code then fetch it or click on this link and download it: ANGULARJS. once downloading the external file you would like to add this file to the head section of your application. Now, I'll show you the way to use the ng-dblclick directive. I am making a TextBox and button and binding the TextBox using the ng-model directive and therefore the button using the ng-dblclick directive. The code is as follows:
<body>
    Name:
    <input ng-model="name" type="text" />
    <button ng-dblclick="Msg='Hello '+name">
        Double Click
    </button>
    </br>
    <h3>
        {{Msg}}</h3>
</body>


Here the TextBox ties with ng-demonstrate, The catch is bound with ng-dblclick and inside the ng-dblclick I have composed 'Hello  '+name. Where Hello is a string and name is a variable that contains the value of the input TextBox. This button will work when you double-click on it.

And here is the code that I used:
<!doctype html>
<html ng-app>
<head>
    <script src="angular.min.js"></script>
</head>
<body>
    Name:
    <input ng-model="name" type="text" />
    <button ng-dblclick="Msg='Hello '+name">
        Double Click
    </button>
    </br>
    <h3>
        {{Msg}}</h3>
</body>
</html>

Here is the Output, when Page loads:

HostForLIFE.eu AngularJS Hosting
HostForLIFE.eu 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 customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



Node.js Hosting UK - HostForLIFE.eu :: Cluster Server Object in NodeJS

clock March 17, 2015 06:44 by author Peter

In this tutorial , I will discuss about Cluster Server in NodeJS. That is a group of two or more computers that work together to provide availability, reliability and scalability that can be obtained using a single computer. In a server cluster, each server owns and manages devices and applications or services that are managing local cluster. 

To make the new Node Web Application open Visual Studio then select "File" -> "New Web Site" then select "Node Web Application" as in the accompanying figure:

Create a new Script file from the Solution Explorer as in the following figure:

And then select the new JavaScript file as in the following figure:

 

Write the following code in a JavaScript File.
(function () {
    '';
    var cls = require('cluster'),
        http = require('http'),
        os = require('os'),
        ClsServer = {
            clusname: 'ClusterServer',
            cpus: os.cpus().length,
            autoRestart: true,
            start: function (server, port) {
                var me = this,
                    i;
                if (cls.isMaster) {
                    for (i = 0; i < me.cpus; i += 1) {
                        console.log(me.name + ': starting worker thread #' + i);
                        cls.fork();
                    }
                    /*cls.on('death', function (worker) {
                        console.log(me.clusname + ': worker ' + worker.pid + ' died.');
                        if (me.autoRestart) {
                            console.log(me.clusname + ':thread restart');
                            cls.fork();
                        }
                    });*/
                } else {
                    server.listen(port);
                }
            }
        }
        helloWorldServer = http.createServer(function (request, response) {
           response.writeHead(200, {
                'Content-type': 'text/plain'
            });
                        response.end('Hello World!');
        });
    ClsServer.name = 'hello World Server';
    ClsServer.start(helloWorldServer, 8081);
}());

In the above case we make a ClusterServer article to begin multi-strung server examples by passing the server item to ClusterServer.start(server,port). Servers are naturally begun with various strings proportional to the quantities of CPUs reported by the os module.Debug the application by pressing F5 and the output will be demonstrated in a reassure application as in the accompanying figure: 

HostForLIFE.eu Node.js Hosting
HostForLIFE.eu 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 customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



HostForLIFE.eu Launches New Data Center in Frankfurt (Germany)

clock March 10, 2015 11:59 by author Peter

HostForLIFE.eu, a leading Windows hosting provider with innovative technology solutions and a dedicated professional services team proudly announces new Data Center in Frankfurt (Germany) for all costumers. HostForLIFE’s new data center in Frankfurt will address strong demand from customers for excellent data center services in Europe, as data consumption and hosting services experience continued growth in the global IT markets.

The new facility will provide customers and our end users with HostForLIFE.eu services that meet in-country data residency requirements. It will also complement the existing HostForLIFE.eu. The Frankfurt (Germany) data center will offer the full range of HostForLIFE.eu web hosting infrastructure services, including bare metal servers, virtual servers, storage and networking.

HostForLIFE.eu expansion into Frankfurt gives them a stronger European market presence as well as added proximity and access to HostForLIFE.eu growing customer base in region. HostForLIFE.eu has been a leader in the dedicated Windows & ASP.NET Hosting industry for a number of years now and we are looking forward to bringing our level of service and reliability to the Windows market at an affordable price.

The new data center will allow customers to replicate or integrate data between Frankfurt data centers with high transfer speeds and unmetered bandwidth (at no charge) between facilities. Frankfurt itself, is a major center of business with a third of the world’s largest companies headquartered there, but it also boasts a large community of emerging technology startups, incubators, and entrepreneurs.

Our network is built from best-in-class networking infrastructure, hardware, and software with exceptional bandwidth and connectivity for the highest speed and reliability. Every upstream network port is multiple 10G and every rack is terminated with two 10G connections to the public Internet and two 10G connections to our private network. Every location is hardened against physical intrusion, and server room access is limited to certified employees.

All of HostForLIFE.eu controls (inside and outside the data center) are vetted by third-party auditors, and we provide detailed reports for our customers own security certifications. The most sensitive financial, healthcare, and government workloads require the unparalleled protection HostForLIFE.eu provides.

Frankfurt (Germany) data centres meet the highest levels of building security, including constant security by trained security staff 24x7, electronic access management, proximity access control systems and CCTV. HostForLIFE.eu is monitored 24/7 by 441 cameras onsite. All customers are offered a 24/7 support function and access to our IT equipment at any time 24/7 by 365 days a year. For more information about new data center in Frankfurt, please visit http://hostforlife.eu/Frankfurt-Hosting-Data-Center

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.

HostForLIFE.eu is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft (see http://www.asp.net/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.



AngularJS Hosting UK - HostForLIFE.eu :: The .directive and .filter Service in AngularJS

clock March 10, 2015 07:03 by author Peter

This article clarifies the .directive and .filter service in AngularJS. Precise gives numerous sorts of administrations, two of them are directive and filter. In this article I will demonstrate to you an application in which both of the administrations are utilized.

Most importantly you have to add an outside Angular.js record to your application, as it were "angular.min.js".  For this you can go to the AngularJS official site.In the wake of downloading the external file you have to add this document to the Head segment of your application.
<head runat="server">
    <title></title>
    <script src="angular.min.js"></script>
</head>

After add the External JS file, the first thing you should do is to add ng-app in the <HTML> Tag otherwise your application will not run.
<html ng-app xmlns="http://www.w3.org/1999/xhtml">


On the JavaScript function, write the following code in the head section:
    <script>
        var x = angular.module('x', []); 
        function ctrl($scope) {
            $scope.name = 'testing';
       }
        angular.module('mod', [])
          .filter('ifarray', function () {
              return function (input) {
                  return $.isArray(input) ? input : [];
              }
         })
          .directive('list', function ($compile) {
              return {
                  restrict: 'E',
                  terminal: true,
                  scope: { val: 'evaluate' },
                  link: function (scope, element, attrs) {
                      if (angular.isArray(scope.val)) {
                          element.append('<div>+ <div ng-repeat="v in val"><list val="v"></list></div></div>');
                      } else {
                          element.append('  - {{val}}');
                      }
                     $compile(element.contents())(scope.$new());
                  }
              }
         });
        angular.module('x', ['mod']);
     </script>

Here I made a module whose name is "x", this module will be brought in the g-app directive. After this I made a functionwhose name is "ctrl", in this function one introductory value is passed in the variable "name".  After making the function, I utilized the filter and directive administrations, in the directive administration I passed limit as "E". In this directive service I connected an "if" circle that will check whether the Array is utilized, if the array is utilized then it will attach a few controls to the component. I utilized a <list> control that is not a control, it’s an customized control that is not accessible in HTML. Now our work on JavaScript is completed and we can move to the design part of our application. Write this code in the body section:
<body>
    <form ng-app="x" id="form1" runat="server">
    <pre>
        <list val="['item1','item2',['item3','item4']]">
        </list>
    </pre>
    </form>
</body>

Here I bound the module name with the form using the ng-app directive. I utilized the custom component that was pronounced in the second step, in this <list> I bound some beginning values that will be seen in the yield window. Now, our application is made and is prepared for execution.

Output
When you running the application you will get a output like this:

You can see that the <list> is showing the output but it was not any official element.
The complete code of this application is as follows:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="JavaScript1.js"></script>
    <script>
        var x = angular.module('x', []);
        function ctrl($scope) {
            $scope.name = 'testing';
        }
        angular.module('mod', [])
          .filter('ifarray', function () {

              return function (input) {
                  return $.isArray(input) ? input : [];
             }
          })
          .directive('list', function ($compile) {
              return {
                  restrict: 'E',
                  terminal: true,
                  scope: { val: 'evaluate' },
                  link: function (scope, element, attrs) {
                      if (angular.isArray(scope.val)) {
                          element.append('<div>+ <div ng-repeat="v in val"><list val="v"></list></div></div>');
                      } else {
                          element.append('  - {{val}}');
                      }
                      $compile(element.contents())(scope.$new());
                  }
              }
          });
        angular.module('x', ['mod']);
    </script>
</head>
<body>
    <form ng-app="x" id="form1" runat="server">
    <pre>
        <list val="['item1','item2',['item3','item4']]">
        </list>
   </pre>
    </form>
</body>
</html>

HostForLIFE.eu AngularJS Hosting
HostForLIFE.eu 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 customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



Ajax Hosting UK - HostForLIFE.eu :: How to Edit the GridView Row Values in ASP.NET with Ajax ?

clock March 3, 2015 08:40 by author Peter

In this post, I explain you about how to edit the GridView Row Values in ASP.NET with Ajax. First, create a new project on Visual Studio. In ASP.NET write the following code:

 

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title> How to Edit the GridView Row Values in ASP.NET with Ajax </title> 
<style type="text/css">
    .modalBackground
    {
        background-color: black;      
        opacity: 0.7;      
    }
 #grd
 {
     margin:25px;
}
</style>
</head>
<body>
   <form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:DropDownList></asp:DropDownList>
<h4>Details</h4>
<div>
      <asp:GridView ID="grd" runat ="server"  GridLines="Both" BorderColor="#4F81BD" BorderStyle="Solid"
                            BorderWidth="1px" Style="position: static"  AutoGenerateColumns="false" >          <Columns>
              <asp:BoundField DataField="User_id" HeaderText="User ID" SortExpression="User_id" />
              <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />              <asp:BoundField DataField="Email_Address" HeaderText="Email Address"                  SortExpression="Email_Address" />          
           <asp:BoundField DataField="Mobile" HeaderText="Mobile No" SortExpression="Mobile" />
                             <asp:TemplateField HeaderText="Edit">
<ItemTemplate>
    <asp:LinkButton ID="lnkBtn" runat="server" OnClick="lnkbtn_Click">Edit</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
          </Columns>

<RowStyle BorderColor="Red" BorderWidth="2px"></RowStyle>
         </asp:GridView>
</div>
           <asp:Button ID="btnShow" Visible="true" runat="server" />
            <ajax:ModalPopupExtender ID="ModalPopup" runat="server" TargetControlID="btnShow"
                BackgroundCssClass="modalBackground" PopupControlID="PnlShow">
            </ajax:ModalPopupExtender>
                      <div ID="PnlShow" runat="server" style="display: none;background-color:white;">
             <span style="float: right; padding-right: 0px; margin: 0px;">
                         <asp:Button ID="btnClose" Text="X" runat ="server" />
             </span>
                <div style="margin:25px;">
<table >
<tr>
<td colspan="2" >User Details</td>
</tr>
<tr><td>User Id</td>
<td>Name</td>
<td>Email_Address</td>
<td>Mobile No.</td>
</tr>
<tr>
<td><asp:Label ID="lblID" runat="server" /></td>
<td><asp:TextBox ID="txtName" runat="server" /></td>
<td><asp:TextBox ID="txtEmail" runat="server" /></td>
<td><asp:TextBox ID="txtMobile" runat="server" /></td>
</tr>
<tr>
<td>
<asp:Button ID="btnUpdate" CommandName="Update" runat="server" Text="Update" onclick="btnUpdate_Click"/>
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
                </div>                          
            </div>
</form>
</body>
</html>


In C#.NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class AjaxModalPopUp : System.Web.UI.Page
{
    SP obj = new SP();
    protected void Page_Load(object sender, EventArgs e)
    {
        BindData();
        btnShow.Visible = false;
    }
   protected void BindData()
    {    
        DataSet ds = obj.Display();
        grd.DataSource = ds;
        grd.DataBind();
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        obj.id = Convert.ToInt32(lblID.Text);
        obj.name = txtName.Text;
        obj.email = txtEmail.Text;
        obj.mobile = txtMobile.Text;
        obj.Update();
        Response.Write ("<script>alert('Details Updated Successfully');</script>");    
        BindData();
    }
    protected void lnkbtn_Click(object sender, EventArgs e)
    {
        LinkButton LNK = sender as LinkButton;
        GridViewRow gvrow = (GridViewRow)LNK.NamingContainer;
        lblID.Text = gvrow.Cells[0].Text;
        txtName.Text = gvrow.Cells[1].Text;       
        txtEmail.Text = gvrow.Cells[2].Text;
        txtMobile.Text = gvrow.Cells[3].Text;
        btnShow.Visible = true;
        ModalPopup.Show();
    }
 }


In App_Code/SP.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Configuration;
using System.Data.Common ;
public class SP
{
    public int id { get; set; }
    public string name { get; set; }
    public string email { get; set; }
    public string mobile { get; set; }
    public int studentId { get; set; }
    public string item { get; set; }
    public DataSet Display()
    {
        DataSet ds;
        try
        {           
            DbCommand cmd = sqlCon.GetStoredProcCommand("Display_Users");
            ds = sqlCon.ExecuteDataSet(cmd);
            return ds;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    public int Update()
    {
        int checkUser;
        try
        {

            DbCommand cmd = sqlCon.GetStoredProcCommand("Update_user");
            sqlCon.AddInParameter(cmd, "@userId", DbType.String, id);
            sqlCon.AddInParameter(cmd, "@name", DbType.String, name);
            sqlCon.AddInParameter(cmd, "@email", DbType.String, email);
            sqlCon.AddInParameter(cmd, "@mobile", DbType.String, mobile);
            checkUser = sqlCon.ExecuteNonQuery(cmd);
            return checkUser;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
}

In VB.net
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.SqlClient
Partial Public Class AjaxModalPopUp
    Inherits System.Web.UI.Page
    Private obj As New SP()
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        BindData()
        btnShow.Visible = False
    End Sub
    Protected Sub BindData()
        Dim ds As DataSet = obj.Display()
        grd.DataSource = ds
        grd.DataBind()
    End Sub
    Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As EventArgs)
        obj.id = Convert.ToInt32(lblID.Text)
        obj.name = txtName.Text
        obj.email = txtEmail.Text
        obj.mobile = txtMobile.Text
        obj.Update()
        Response.Write("<script>alert('Details Updated Successfully');</script>")
        BindData()
    End Sub
    Protected Sub lnkbtn_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim LNK As LinkButton = TryCast(sender, LinkButton)
        Dim gvrow As GridViewRow = DirectCast(LNK.NamingContainer, GridViewRow)
        lblID.Text = gvrow.Cells(0).Text
        txtName.Text = gvrow.Cells(1).Text
        txtEmail.Text = gvrow.Cells(2).Text
        txtMobile.Text = gvrow.Cells(3).Text
        btnShow.Visible = True
        ModalPopup.Show()
    End Sub
End Class


In App_Code/SP.vb
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.Data.Sql
Imports System.Configuration
Imports System.Data.Common
Public Class SP
    Public Property id() As Integer
        Get
            Return m_id
        End Get
        Set(ByVal value As Integer)
            m_id = Value
        End Set
    End Property
    Private m_id As Integer
    Public Property name() As String
        Get
            Return m_name
        End Get
        Set(ByVal value As String)
            m_name = Value
        End Set
    End Property
    Private m_name As String
    Public Property email() As String
       Get
            Return m_email
        End Get
        Set(ByVal value As String)
            m_email = Value
        End Set
    End Property
    Private m_email As String
    Public Property mobile() As String
        Get
            Return m_mobile
        End Get
        Set(ByVal value As String)
            m_mobile = Value
        End Set
    End Property
    Private m_mobile As String
    Public Property studentId() As Integer
        Get
            Return m_studentId
        End Get
        Set(ByVal value As Integer)
            m_studentId = Value
       End Set
    End Property
    Private m_studentId As Integer
    Public Property item() As String
        Get
            Return m_item
       End Get
        Set(ByVal value As String)
            m_item = Value
       End Set
    End Property
   Private m_item As String
    Public Function Display() As DataSet
        Dim ds As DataSet
       Try
            Dim cmd As DbCommand = sqlCon.GetStoredProcCommand("Display_Users")
            ds = sqlCon.ExecuteDataSet(cmd)
            Return ds
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Public Function Update() As Integer
        Dim checkUser As Integer
       Try
            Dim cmd As DbCommand = sqlCon.GetStoredProcCommand("Update_user")       sqlCon.AddInParameter(cmd, "@userId", DbType.[String], id)
            sqlCon.AddInParameter(cmd, "@name", DbType.[String], name)
            sqlCon.AddInParameter(cmd, "@email", DbType.[String], email)
            sqlCon.AddInParameter(cmd, "@mobile", DbType.[String], mobile)
           checkUser = sqlCon.ExecuteNonQuery(cmd)
            Return checkUser
        Catch ex As Exception
            Throw ex
        End Try
    End Function
End Class

HostForLIFE.eu Ajax Hosting
HostForLIFE.eu 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 customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.

 

 



About HostForLIFE.eu

HostForLIFE.eu 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 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.


Tag cloud

Sign in