Full Trust European Hosting

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

HostForLIFE.eu Proudly Launches ASP.NET Core 1.0 RC2 Hosting

clock June 4, 2016 01:09 by author Peter

HostForLIFE.eu was established to cater to an underserved market in the hosting industry; web hosting for customers who want excellent service. HostForLIFE.eu - a cheap, constant uptime, excellent customer service, quality, and also reliable hosting provider in advanced Windows and ASP.NET technology. HostForLIFE.eu proudly announces the availability of the ASP.NET Core 1.0 RC2 hosting in their entire servers environment.

ASP.NET is Microsoft's dynamic website technology, enabling developers to create data-driven websites using the .NET platform and the latest version is 5 with lots of awesome features. ASP.NET Core 1.0 RC2 is a lean .NET stack for building modern web apps. Microsoft built it from the ground up to provide an optimized development framework for apps that are either deployed to the cloud or run on-premises. It consists of modular components with minimal overhead.

A key change that occurred between RC1 and RC2 is the introduction of the .NET command-line interface.  This tool replaces the dnvm, dnx, and dnu utilities with a single tool that handles the responsibilities of these tools. In RC1 an ASP.NET application was a class library that contained a Startup.cs class. When the DNX toolchain run your application ASP.NET hosting libraries would find and execute the Startup.cs, booting your web application. Whilst the spirit of this way of running an ASP.NET Core application still exists in RC2, it is somewhat different. As of RC2 an ASP.NET Core application is a .NET Core Console application that calls into ASP.NET specific libraries. What this means for ASP.NET Core apps is that the code that used to live in the ASP.NET Hosting libraries and automatically run your startup.cs now lives inside a Program.cs.

HostForLIFE.eu hosts its servers in top class data centers that is located in Amsterdam (NL), London (UK), Paris (FR), Frankfurt(DE) and Seattle (US) 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. The customers can start hosting their ASP.NET Core 1.0 RC2 site on their environment from as just low €3.00/month only.

HostForLIFE.eu is a popular online ASP.NET based hosting service provider catering to those people who face such issues. The company has managed to build a strong client base in a very short period of time. It is known for offering ultra-fast, fully-managed and secured services in the competitive market.

HostForLIFE.eu offers the latest European ASP.NET Core 1.0 RC2 hosting installation to all their new and existing customers. The customers can simply deploy their ASP.NET Core 1.0 RC2 website via their world-class Control Panel or conventional FTP tool. HostForLIFE.eu is happy to be offering the most up to date Microsoft services and always had a great appreciation for the products that Microsoft offers.

Further information and the full range of features ASP.NET Core 1.0 RC2 Hosting can be viewed here http://hostforlife.eu



ASP.NET MVC 5 Hosting - HostForLIFE.eu :: How To Create Dropdown Menu?

clock May 4, 2016 00:37 by author Anthony

In this article, I will explain about how to implement Dropdown list in ASP.NET MVC. In traditional ASP.NET it is very easy to implement just by drag and dropping where we want. But in MVC we need some attention to create Drop Downlist.We have Dropdown list Html helper in ASP.NET MVC but we need to know how to bind data to Dropdown list Html helpers.
we can implement Drop down list in ASP.NET MVC in 2 ways.


Free ASP.NET Hosting - Europe

1.Using normal HTML Controls(select tag):

We can implement  dropdownlist using HTML <select/> tag like below
 ExampleCode:


<select id="html_dropdown">
    <option>--Select--</option>
    <option>India</option>
    <option>US</option>
    <option>China</option>
    <option>Russia</option>
    <option>United Kingdom</option>
</select>


2.Using HTML helpers:

Method 1: 


It is very easy to implement dropdownlist using normal html tags. But, if you want to bind data dynamically to the HTML tags it becomes complicated.To overcome and to make it easy to bind data to Html controls Microsoft introduced HTML helpers Methods.Here we are using Dropdown HTML helper to bind object data to Dropdownlist
.


Advantages:
1.It is also easy to implement.
2.Dynamic binding of data is very easy
3.We can easily implement cascading dropdownlists
Note:In method 1 i am sending data from controller using ViewBag. 


ExampleCode:

//Using ViewBag
            List<selectlistitem> item = new List<selectlistitem>();
            item.Add(new SelectListItem { Text = "India", Value = "1" });
            item.Add(new SelectListItem { Text = "China", Value = "2" });
            item.Add(new SelectListItem { Text = "United Sates", Value = "3" });
            item.Add(new SelectListItem { Text = "Srilanka", Value = "4" });
            item.Add(new SelectListItem { Text = "Germany", Value = "5" });
            ViewBag.html_helper_dropdown = item;
</selectlistitem></selectlistitem>

View code:

@using (Html.BeginForm())
{
    @Html.DropDownList("html_helper_dropdown","--select--")
}


Method 2:


In this i am sending data using ViewData to Controller with the same data source


Code:

List<selectlistitem> item = new List<selectlistitem>();
 item.Add(new SelectListItem { Text = "India", Value = "1" });
 item.Add(new SelectListItem { Text = "China", Value = "2" });
 item.Add(new SelectListItem { Text = "United Sates", Value = "3" });
 item.Add(new SelectListItem { Text = "Srilanka", Value = "4" });
 item.Add(new SelectListItem { Text = "Germany", Value = "5" });
ViewData["viewdata_ddl"] = item;
</selectlistitem></selectlistitem>

view code:

<p>Using View data</p>
@using (Html.BeginForm())
{
    @Html.DropDownList("viewbag_dropdown",ViewData["viewdata_ddl"] as List<SelectListItem>, "--select--")
}


Method 3:


Model binding.In this method we are binding the data using Model.This method mainly used for Strongly typed Views.


1.First create a model class with the 2 properties. one for Dropdown values and another for storing the selected value.


Model.cs:

using System.Collections.Generic;
using System.Web.Mvc;
 
namespace Dropdownlist.Models
{
    public class Model
    {
        public string selectedType { get; set; }
        public IEnumerable<selectlistitem> CountryList { get; set; }
    }
}
</selectlistitem>


Then prepare data source in controller and send the data through return View() method


Controller code:

using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Dropdownlist.Models;
 
namespace Dropdownlist.Controllers
{
    public class HomeController : Controller
    {
 
        public ActionResult Index()
        {
            //Using ViewBag
            List<selectlistitem> item = new List<selectlistitem>();
            item.Add(new SelectListItem { Text = "India", Value = "1" });
            item.Add(new SelectListItem { Text = "China", Value = "2" });
            item.Add(new SelectListItem { Text = "United Sates", Value = "3" });
            item.Add(new SelectListItem { Text = "Srilanka", Value = "4" });
            item.Add(new SelectListItem { Text = "Germany", Value = "5" });
            ViewBag.html_helper_dropdown = item;
 
            //using ViewData
            ViewData["viewdata_ddl"] = item;
 
            //using Model binding
            var model = new Model
            {
                CountryList = item
             };
            return View(model);
        }
 
    }
}
</selectlistitem></selectlistitem>

View code as follows:

<p>Using Model </p>
@using (Html.BeginForm())
{
    @Html.DropDownListFor(x=>x.selectedType,Model.CountryList,"--select--")
}


Index.cshtml:

@using Dropdownlist.Models
@model Model
@{
    ViewBag.Title = "Dropdown list demo";
}

<h1>Dropdown list</h1>
<h3>Drop downlist using HTML</h3>
<select id="html_dropdown">
    <option>--Select--</option>
    <option>India</option>
    <option>US</option>
    <option>China</option>
    <option>Russia</option>
    <option>United Kingdom</option>
</select>
<br/>
<h3>Using Html helpers </h3>
<p>Method 1:</p><br/>
<p>Here the data was sent from Controller through ViewBag</p>
@using (Html.BeginForm())
{
    @Html.DropDownList("html_helper_dropdown","--select--")
}
<br/>
<p>Method 2:</p>
<p>Using View data</p>
@using (Html.BeginForm())
{
    @Html.DropDownList("viewbag_dropdown",ViewData["viewdata_ddl"] as List<SelectListItem>, "--select--")
}
<p>Method 3:</p>
<p>Using Model </p>
@using (Html.BeginForm())
{
    @Html.DropDownListFor(x=>x.selectedType,Model.CountryList,"--select--")
}

Note: We can also bind the dropdownlist data using ENUM's and arrays also.But, above are the most reliable and used by many developers (in our company also developers uses this methods only.).
Finally i got output like this.

 

 

 

HostForLIFE.eu ASP.NET MVC 5 Hosting
HostForLIFE.eu revolutionized hosting with Plesk Control Panel, a Web-based interface that provides customers with 24x7 access to their server and site configuration tools. Plesk completes requests in seconds. It is included free with each hosting account. Renowned for its comprehensive functionality - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLIFE's customers. They
offer a highly redundant, carrier-class architecture, designed around the needs of shared hosting customers.

 

http://aspnetmvceuropeanhosting.hostforlife.eu/image.axd?picture=2015%2f10%2fhostforlifebanner.png



ASP.NET MVC 4 Hosting - HostForLIFE.eu :: How To Add MVC Model?

clock April 26, 2016 23:28 by author Anthony

Model–view–controller (MVC) is a software architectural pattern for implementing user interfaces on computers. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.

Free ASP.NET Hosting - Europe

Traditionally used for desktop graphical user interfaces (GUIs), this architecture has become extremely popular for designing web applications.

MVC

The MVC(Model View Controller) separates an application into three main components.
This includes Model,View and Controller.
In this article, mainly explained about Models.


Models

Model represents an object. Model is resposible for maintaining the data
It respond to the request from view. It also respond to the instruction from controller for the updation.

Model objects retrieve and store model state in a database.
For example, a Student object might retrieve information from a StudentData Database, operate on it, and then write updated information back to a StudentData table in a SQL Server database.

In MVC, model both hold and manipulate application data. It contains all the application logic except view and controller logic

Model Folder contains the classes of application.


Model Adding

We can add models to our application with the following steps

  • A model folder will be present under the created application's Solution Explorer.

  • Right click on Model folder. A list will be appearing
  • Select 'Add' option from list.Then a new list will be coming.
  • Then select 'Class' option from list
  • A new window appearing.Here give the name for the new class or model and select 'Add'.(Say model name as SampleModel)
  • The newly added class will be appearing.That is, this will create a model class to the application.
  • Inside this class, we can add properties as per the requirements. Example is given below.
  •  


HostForLIFE.eu ASP.NET MVC 4 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.

     



Joomla 3.5 Hosting - HostForLIFE.eu :: Joomla 3.5 Beta Testing

clock April 14, 2016 23:15 by author Anthony

Joomla is an award-winning content management system (CMS), which enables you to build Web sites and powerful online applications. Many aspects, including its ease-of-use and extensibility, have made Joomla the most popular Web site software available. Best of all, Joomla is an open source solution that is freely available to everyone.

Free ASP.NET Hosting - Europe

Joomla is used all over the world to power Web sites of all shapes and sizes. For example:

  • Corporate Web sites or portals
  • Corporate intranets and extranets
  • Online magazines, newspapers, and publications
  • E-commerce and online reservations
  • Government applications
  • Small business Web sites
  • Non-profit and organizational Web sites
  • Community-based portals
  • School and church Web sites
  • Personal or family homepages

Joomla 3.5 was released on February 17, 2016. Here is a glimpse of what will be on Joomla 3.5. Joomla users have the opportunity to test the beta and pre-release versions given by the official Joomla development team.

If you are using Joomla and would like to contribute or you just want to test the latest features of Joomla 3.5 and its extensions, of course this is very useful. You can find some of the features that may not have been perfect and needs to be improved to be released in due course.

This time I will show you how to test the beta version of Joomla 3.5 on your website that Joomla version 3.4.x.
# Note: Do not do this test on your website is running, it helps you create a duplicate to avoid the risks that can be generated.

Step # 1. Turn Mode Update Version Joomla For Testing

Access to the menu Components -> Joomla Update -> Click on the "Option"

Update Enable Channel to "Testing"

Then click the "Save and close".
Step # 2. Fix Joomla to Beta
If there is a Joomla test version available (it will commonly use the suffix -beta # in "Latest Joomla version" row), click the "Install the update" button and wait until the process ends.

Step # 3. The trial version of Joomla Beta

Until this stage, you have managed to make updates to the Joomla 3, if you find features that have not been perfect, immediately report it to Github repository page, hopefully Joomla core team can fix it on the next regular release schedule.

 


HostForLIFE.eu Joomla 3.5 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 :: HostForLIFE.eu :: How to Work With PHP and MySQL?

clock April 12, 2016 23:12 by author Anthony

Today we will discuss about Ajax. Ajax is a collection of several technologies aiming to provide a better user experience compared to traditional web applications. End to end implementation of Ajax includes HTML, CSS, DOM, JavaScript, a Server Side Language, and XMLHttpRequest which is also called as XHR.

In traditional web applications, the browser sends a request to server, server processes, send some data back to browser and then it is rendered by the browser. But meanwhile, when server is processing, user has to wait. This, needless to say, does not provide the user with a good experience. Ajax, helps to get rid of the issue. It makes the user's interaction to the application asynchronous. User interface and communicating to the server goes hand in hand and without waiting for the server to come with the processed data or without reloading the webpage, the user interface responds to user's action; greatly improving user experience.

In this tutorial we will see how to make Ajax work with PHP and MySQL. We will create a small web application. In that, as soon as you start typing an alphabet in the given input field, a request goes to the PHP file via Ajax, a query is made to the MySQL table, it returns some results and then those results are feteched by Ajax and displayed.

You need to make MySQL table. The structure of the MySQL table we use.

mysql table for ajax php mysql tutorial

We have a simple user inerface created with HTML and CSS where user can supply data in the input field. This is the basic HTML code. Though, we will make modifications on it and add JavaScript code later.

<!DOCTYPE html>  
<html lang="en">  
<head>  
<meta charset="utf-8">  
<title>User interface for Ajax, PHP, MySQL demo</title>  
<meta name="description" content="HTML code for user interface for Ajax, PHP and MySQL demo.">  
<link href="../includes/bootstrap.css" rel="stylesheet"> 
<style type="text/css"> 
body {padding-top: 40px; padding-left: 25%} 
li {list-style: none; margin:5px 0 5px 0; color:#FF0000} 
</style> 
</head> 
<body> 
<form class="well-home span6 form-horizontal" name="ajax-demo" id="ajax-demo"> 
<div class="control-group"> 
              <label class="control-label" for="book">Book</label> 
              <div class="controls"> 
                <input type="text" id="book"> 
              </div> 
 </div> 
 <div class="control-group"> 
              <div class="controls"> 
                <button type="submit" class="btn btn-success">Submit</button> 
              </div> 
 </div> 
</form> 
</body> 
</html> 

This is how it looks :

user interface for ajax demo

We will now create JavaScript code to send data to server. And we will call that code on onkeyup event of the of the input field given.

function book_suggestion() 

var book = document.getElementById("book").value; 
var xhr; 
 if (window.XMLHttpRequest) { // Mozilla, Safari, ... 
    xhr = new XMLHttpRequest(); 
} else if (window.ActiveXObject) { // IE 8 and older 
    xhr = new ActiveXObject("Microsoft.XMLHTTP"); 

var data = "book_name=" + book; 
     xhr.open("POST", "book-suggestion.php", true);  
     xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                   
     xhr.send(data); 

Processing data on server side

<?php 
include('../includes/dbopen.php'); 
$book_name = $_POST['book_name']; 
$sql = "select book_name from book_mast where book_name LIKE '$book_name%'"; 
$result = mysql_query($sql); 
while($row=mysql_fetch_array($result)) 

echo "<p>".$row['book_name']."</p>"; 

?> 

Now we have to retreive data returned by MYSQL and display that data using Ajax. So, we will write that code in our HTML file. We will add follwing code

xhr.onreadystatechange = display_data; 
    function display_data() { 
     if (xhr.readyState == 4) { 
      if (xhr.status == 200) { 
       document.getElementById("suggestion").innerHTML = xhr.responseText; 
      } else { 
        alert('There was a problem with the request.'); 
      } 
     } 
  }

We have to add <div id="suggestion"></div> bellow the input field whose id is book.

Now we set the value of the string to be displayed within the div whose id is 'suggestion' as 'responseText' property of the XMLHttpRequest object. 'responseText' is the response to the request as text.

So, the final JavaScript code of the HTML file becomes as follows:

  function book_suggestion() 

var book = document.getElementById("book").value; 
var xhr; 
 if (window.XMLHttpRequest) { // Mozilla, Safari, ... 
    xhr = new XMLHttpRequest(); 
} else if (window.ActiveXObject) { // IE 8 and older 
    xhr = new ActiveXObject("Microsoft.XMLHTTP"); 

var data = "book_name=" + book; 
     xhr.open("POST", "book-suggestion.php", true);  
     xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                   
     xhr.send(data); 
     xhr.onreadystatechange = display_data; 
    function display_data() { 
     if (xhr.readyState == 4) { 
      if (xhr.status == 200) { 
       //alert(xhr.responseText);       
      document.getElementById("suggestion").innerHTML = xhr.responseText; 
      } else { 
        alert('There was a problem with the request.'); 
      } 
     } 
    } 

 

HostForLIFE.eu AJAX Hosting
HostForLIFE.eu revolutionized hosting with Plesk Control Panel, a Web-based interface that provides customers with 24x7 access to their server and site configuration tools. Plesk completes requests in seconds. It is included free with each hosting account. Renowned for its comprehensive functionality - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLIFE's customers. They offer a highly redundant, carrier-class architecture, designed around the needs of shared hosting customers.



Wordpress Hosting - HostForLIFE.eu :: How To Make The First Post?

clock April 8, 2016 00:01 by author Anthony

This tutorial will discuss how to create a new Page and Post on wordpress. Wherein the Post and Page this is the most will often be used when the website was built and after the website goes online, since Page and Post is the place where we put the information we want to upload on our website. If the website is used to blogging as well as for a news portal, then the Post will very often be used to post the latest posts.

WordPress was born out of a desire, wordpress initially ber personal publishing system architecture is elegantly built in PHP and MySQL and licensed under the GPL. WordPress is the official successor of b2 / cafelog. WordPress is a modern software for creating web, but wordpress developed back in 2001. It is a mature and stable. WordPress senidir wish to focus on user experience and web standards different tool with other existing web tool diluaran there. And now total 49% of websites worldwide are built with WordPress.

Here are the steps in the manufacture of a new Post and Page:

Click the sidebar menu on the dashboard pages, and then click add new as the picture below:

Membuat page baru

Bulk Action is used to remove or edit a page or post simultaneously by way of checking the page and posts would be deleted or edited. if you want to edit one by one simply by mensorot title of Page and Post will display the edit menu, trash and quick edit.

The next step to create a new Page after we click the button Add New.

Title is filled with About. Columns underneath used to fill what would we write and we publish. and if you want to insert a picture in the post-click Add Media and select the image you want to paste in your articles.

Featured Image: used to upload thumbnail images in posts

Immediately Publish: used to schedule our posts when the time to dipublis to our website.

Next make Post, essentially making the Post as well as make Page, for the menu to be clicked namely Posts and Add New, cuman difference in Post with Page that is located on the Categories and Tags, for writing Tag adjust to the discussion of the article already you write, in my example menulisakan CMS and WordPress, because my writing related to the topic, and the writing on the tag must be separated by commas. as shown below.

 

category&tag

 


HostForLIFE.eu Wordpress Hosting
HostForLIFE.eu revolutionized hosting with Plesk Control Panel, a Web-based interface that provides customers with 24x7 access to their server and site configuration tools. Plesk completes requests in seconds. It is included free with each hosting account. Renowned for its comprehensive functionality - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLIFE's customers. They
offer a highly redundant, carrier-class architecture, designed around the needs of shared hosting customers.

 



DotNetNuke 7.4 Hosting - HostForLIFE.eu :: How To Install DotNetNuke 7 on your PC?

clock March 31, 2016 20:01 by author Anthony

DotNetNuke is a web application framework that is open source using VB.NET language. Application of CMS can be expanded through the use of modules and skins so this application is used to create, deploy, and set up intranets, extranets and websites. DotNetNuke Professional Edition include the addition of security, stability, and support of products and applications warranty, and is available in a cheaper price than other applications.

Free ASP.NET Hosting - Europe

Moreover DotNetNuke is very easy to install on your PC. So the discussion this time. I will discuss how to install DotNetNuke on your PC. In general, DotNetNuke installation process does not take more than 15 minutes. But if you encounter an error, please check the back, make sure you have meet the minumum requirements for hardware and software you have to install DotNetNuke.

How To Install DotNetNuke 7 on your PC?

  • Create a folder on a Web server where DotNetNuke will be executed. For example, in this manual use the folder C: \ DotNetNuke, however, you can choose the location and name of the other. Set permission on this folder so that IIS uses the account "Full Control".

If IIS has not got the permissions "Full Control", right click on the root folder. Click "Sharing and Security" followed by the Security tab. If the Security tab does not exist, you have to "turn off" file sharing simply by choosing Tools> Folder Options, and then click the View tab. Uncheck the option "Use simple file sharing" and click OK. You can now right-click the root folder and access the Security tab

On the Security tab, tick-related accounts that have permissions "Full Control" to this folder (Windows XP using the account ASPNET and other editions of Windows using the account NETWORK SERVICE).

  • If you are using SQL Server, it is necessary to configure the DotNetNuke order to access the database. To do this open the file C: \ DotNetNuke \ web.config using Notepad application.

 Note : If you use the SQL Express configuration, there is no need for additional configuration INSTALL package is configured to use SQL Express by default.

  • Remove the following line at the connectionStrings:
    <Add name = "SiteSqlServer" connectionString = "Data Source =. \ SQLExpress; AttachDBFilename = | DataDirectory | Database.mdf; Integrated Security = True; User Instance = True" providerName = "System.Data.SqlClient" />
  • Delete this line in the appSettings:
    <Add key = "SiteSqlServer" value = "Data Source" =. \ SQLExpress; AttachDBFilename = | DataDirectory | Database.mdf; Integrated Security = True; User Instance = True "/>
  • Delete and edit the following line in the connectionStrings section to match the host name Database server and access your identity:
    <Add name = "SiteSqlServer" connectionString = "Server = (local); Database = DotNetNuke; uid =; pwd =;" providerName = "System.Data.SqlClient" />
  • Delete and edit the following line in the appSettings section to match the host name Database server and access your identity:
    <Add key = "SiteSqlServer" value = "Server = (local); Database = DotNetNuke; uid =; pwd =;" />
  • Save and close the web.config file. You can also store backup files with names web.config.bak as a precaution when the installation process fails and you need to start over.
  • Open the IIS Management Console application Start> Control Panel> Administrative Tools and expand Default Web Site. Create a new Virtual Directory named DotNetNuke then navigate to the folder C:\DotNetNuke. You can choose another name for the Virtual Directory liking (if you do, it needs to be adjusted on the instruction "DotNetNuke Wizard")

HostForLIFE.eu DotNetNuke 7.4 Hosting
HostForLIFE.eu revolutionized hosting with Plesk Control Panel, a Web-based interface that provides customers with 24x7 access to their server and site configuration tools. Plesk completes requests in seconds. It is included free with each hosting account. Renowned for its comprehensive functionality - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLIFE's customers. They 
offer a highly redundant, carrier-class architecture, designed around the needs of shared hosting customers.



Umbraco 7.2.8 Hosting UK - HostForLIFE.eu :: How to Create a Comment Form using MVC in Umbraco

clock October 7, 2015 13:04 by author Rebecca

In this tutorial, I'll show you how to create a comment form using MVC in Umbraco. Many people had a lot of trouble working out how to create forms in Umbraco because a lot of the documentation around is either for an old version of Umbraco, using a third party library or just not very helpful!

So, we're going to start off with creating a partial view in the 'Partials' folder within the 'Views' folder, we'll then add the basic code needed to render the form and link it to a custom surface controller that we'll create in the 'App_Code' folder.

Step 1: Create the partial

Create a partial view in the 'Partials' folder located under the 'Views' folder and name it 'ContactForm' this will be where the GUI part of the form is located, it'll also be what's called from our view page to render the form.

Step 2: Adding the form

To create forms in MVC you can use a neat way of adding elements instead of writing the HTML, for example we can use 'LabelFor', 'EditorFor' and 'ValidationMessageFor' pretty neat right? All of these are preceded by '@Html.' because they're located under the 'Html' class.

See my example below and paste it into a partial view called 'CommentForm' to get started.

    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    @{
        Layout = null;
    }
    
    @using (Html.BeginUmbracoForm("SubmitComment", "CommentFormSurface"))
    {
      @Html.LabelFor(x => Model.Name)
      @Html.EditorFor(x => Model.Name)
      @Html.ValidationMessageFor(x => Model.Name)
    
      @Html.LabelFor(x => Model.Email)
      @Html.EditorFor(x => Model.Email)
      @Html.ValidationMessageFor(x => Model.Email)
    
      @Html.LabelFor(x => Model.Comment)
      @Html.EditorFor(x => Model.Comment)
      @Html.ValidationMessageFor(x => Model.Comment)

This is esseintially the form that people will see and use on our website, it is linked to a model and controller which we will create in step three by means of an inherits statement in the first line which calls the 'CommentFormModel'.

Step 3: Setting up the model and controller

To create the model and controller, you need to create a new class file in the 'App_Code' folder and call it 'CommentController', within this file, you'll add the model and surface controller for your form, copy and paste the below code into the class file to get started.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Net.Mail;
    using System.Text;
    using System.Web;
    using System.Web.Mvc;
    using Umbraco.Web.Mvc;
    using umbraco.BusinessLogic;
    using umbraco.cms.businesslogic.web;
    
    namespace LukeAlderton
    {
        ///
        /// Comment form controller deals with all comment systems
        ///
        public class CommentFormSurfaceController : SurfaceController
        {
            [HttpPost]
            public ActionResult SubmitComment(CommentFormModel model)
            {
                //model not valid, do not save, but return current umbraco page
                if (!ModelState.IsValid)
                {       
                    return CurrentUmbracoPage();
                }
    
                // Create the comment and add then data then publish it
                User author = new User(0);
                Document comment = Document.MakeNew(model.Name, DocumentType.GetByAlias("uBlogsyComment"), author, CurrentPage.Children.First().Id);
                comment.getProperty("uBlogsyCommentName").Value = model.Name;
                comment.getProperty("uBlogsyCommentEmail").Value = model.Email;
                comment.getProperty("uBlogsyCommentWebsite").Value = model.Website;
                comment.getProperty("uBlogsyCommentMessage").Value = model.Comment;
                comment.Publish(author);
                umbraco.library.UpdateDocumentCache(comment.Id);
    
                // Add date to the page
                //TempData.Add("SubmissionMessage", "Your comment was successfully submitted");
    
                // Redirect to current page to clear the form
                return RedirectToCurrentUmbracoPage();
    
                // Redirect to specific page
                //return RedirectToUmbracoPage(2525);
            }
        }
    
        public class CommentFormModel
        {
            [Required]
            [Display(Name = "Name")]
            public string Name { get; set; }
    
            [Required]
            [RegularExpression(@"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$", ErrorMessage = "Invalid Email Address")]
            public string Email { get; set; }
    
            [DataType(DataType.Url)]
            public string Website { get; set; }
    
            [Required]
            [DataType(DataType.MultilineText)]
            public string Comment { get; set; }
        }
    }


This controller is designed to replace the comment function of the uBlogsy comment system which adds a node under the post, within the comments node.

The top class called 'CommentFormSurfaceController' is the surface controller and it handles everything that happens after the form has been submitted, in our case we call the method 'SubmitComment' to add a comment to the post via it.

The lower class called 'CommentFormModel' is our view model and it handles the variables available to us and what they should be displayed as, this model has four variables which can all be accessed via 'model.variablename'.
Step Four: Using the form

To Use the form you simply add the following line into any view in your website:

    @Html.Partial("CommentForm",new LukeAlderton.CommentFormModel())

It's as simple as that!

HostForLIFE.eu Umbraco 7.2.8 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.



AngularJS Hosting - HostForLIFE.eu :: How to Binding Table with JSON String using AngularJS?

clock September 14, 2015 06:39 by author Peter

Today, let me tell you about binding table with JSON String using Angular.This is a really easy Javascript function, that helps to convert Json String to a hypertext mark-up language Table by using AngularJS Frameworks. Define a well structured Json string as shown below, this Json string contains the information of two IT departments with the following code:

var dept1 = {  
    "data": [{  
            "Name": "Robert",  
            "City": "London",  
            "Country": "United Kingdom"  
    },  
            {  
            "Name": "Scott",  
            "City": "Manchester",  
            "Country": "United Kingdom"  
    },  
            {  
            "Name": "Rebecca",  
            "City": "Liverpool",  
            "Country": "United Kingdom"  
    },                    
            {  
            "Name": "Peter",  
            "City": "Bristol",  
            "Country": "United Kingdom"  
    },                    
            {  
            "Name": "Thomas",  
            "City": "Leeds",  
            "Country": "United Kingdom"  
    }]  
}  
var dept2 = {        
    "data": [  
            {  
            "Name": "Ethan",  
            "City": "Cardiff",  
            "Country": "United Kingdom"  
    },               
            {  
            "Name": "David",  
            "City": "Southampton",  
            "Country": "United Kingdom"  
    },                
            {  
            "Name": "Suzan",  
            "City": "Norwich",  
            "Country": "United Kingdom"  
    }  
]  
}
 

JS (Functions)
var app = angular.module('myApp', []);  
 
app.controller('employees', function($scope, $http) {  
    $scope.names = dept1.data;  
    $scope.next = function() {  
        $scope.names = dept2.data;  
    }  
     $scope.prev = function() {  
        $scope.names = dept1.data;  
    }  
});


HTML
<div ng-app="myApp" ng-controller="employees">    
    <input type="button" value="Development" ng-click="prev();">    
          <input type="button" value="Testing" ng-click="next();">    
    <table>    
        <tr ng-repeat="x in names">    
            <td>{{ x.Name }}</td>    
            <td>{{ x.Country }}</td>    
        </tr>    
    </table>    
</div>   
            

CSS
table {    
    border-collapse: collapse;    
    width: 100%;    
}    
th, td {    
    padding: 0.25rem;    
    text-align: left;    
    border: 1px solid #ccc;    
}    
tbody tr:hover {    
    background: yellow;    
}    

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.



HostForLIFE.eu Proudly Launches ASP.NET 4.6 Hosting

clock September 7, 2015 12:36 by author Peter

HostForLIFE.eu was established to cater to an underserved market in the hosting industry; web hosting for customers who want excellent service. HostForLIFE.eu – a cheap, constant uptime, excellent customer service, quality, and also reliable hosting provider in advanced Windows and ASP.NET technology. HostForLIFE.eu proudly announces the availability of the ASP.NET 4.6 hosting in their entire servers environment.

http://hostforlife.eu/img/logo_aspnet1.png

ASP.NET is Microsoft's dynamic website technology, enabling developers to create data-driven websites using the .NET platform and the latest version is 5 with lots of awesome features. ASP.NET 4.6 is a lean .NET stack for building modern web apps. Microsoft built it from the ground up to provide an optimized development framework for apps that are either deployed to the cloud or run on-premises. It consists of modular components with minimal overhead.

According to Microsoft officials, With the .NET Framework 4.6, you'll enjoy better performance with the new 64-bit "RyuJIT" JIT and high DPI support for WPF and Windows Forms. ASP.NET provides HTTP/2 support when running on Windows 10 and has more async task-returning APIs. There are also major updates in Visual Studio 2015 for .NET developers, many of which are built on top of the new Roslyn compiler framework. The .NET languages -- C# 6, F# 4, VB 14 -- have been updated, too.There are many great features in the .NET Framework 4.6. Some of these features, like RyuJIT and the latest GC updates, can provide improvements by just installing the .NET Framework 4.6.

HostForLIFE.eu hosts its servers in top class data centers that is located in Amsterdam (NL), London (UK), Paris (FR), Frankfurt(DE) and Seattle (US) 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. The customers can start hosting their ASP.NET 4.6 site on their environment from as just low €3.00/month only.

HostForLIFE.eu is a popular online ASP.NET based hosting service provider catering to those people who face such issues. The company has managed to build a strong client base in a very short period of time. It is known for offering ultra-fast, fully-managed and secured services in the competitive market.

HostForLIFE.eu offers the latest European ASP.NET 4.6 hosting installation to all their new and existing customers. The customers can simply deploy their ASP.NET 4.6 website via their world-class Control Panel or conventional FTP tool. HostForLIFE.eu is happy to be offering the most up to date Microsoft services and always had a great appreciation for the products that Microsoft offers.

Further information and the full range of features ASP.NET 4.6 Hosting can be viewed here http://hostforlife.eu/European-ASPNET-46-Hosting



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