Getting Started

17 Feb 20221 minute to read

This section briefly explains about how to render Avatar component in your ASP.NET MVC application. You can
refer ASP.NET MVC Getting Started documentation page for introduction part of
the system requirements and configure the common specifications.

Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, you also have to include a license key in your projects. Please refer to this link to know about registering Syncfusion license key in your ASP .NET MVC application to use our components.

Adding Avatar component to the Application

Since the Avatar is a CSS component there is no need to html tag helper, the component is added by using CSS
classes. Add the below code to your index.cshtml page which is present under Views/Home folder.

<span class="e-avatar">GR</span>

After successful compilation of your application, simply press F5 to run the application.

The following example shows a basic Avatar.

<div id='element'>
    <span class="e-avatar e-avatar-xlarge"></span>
    <span class="e-avatar e-avatar-large"></span>
    <span class="e-avatar"></span>
    <span class="e-avatar e-avatar-small"></span>
    <span class="e-avatar e-avatar-xsmall"></span>
</div>

<style>
#element {
    display: block;
    width: 300px;
    margin: 130px auto;
    border-radius: 3px;
    justify-content: center;
}

.e-avatar {
    background-image: url(./pic01.png);
    margin: 2px;
}
</style>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace EJ2MVCSampleBrowser.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    }

}

Output be like the below.

Avatar Sample

See Also

Types of Avatar