Getting Started with ASP.NET Core TextBox Control

16 Feb 20247 minutes to read

This section briefly explains about how to include ASP.NET Core TextBox control in your ASP.NET Core application using Visual Studio.


System requirements for ASP.NET Core controls

Create ASP.NET Core web application with Razor pages

Install ASP.NET Core package in the application

To add ASP.NET Core controls in the application, open the NuGet package manager in Visual Studio (Tools → NuGet Package Manager → Manage NuGet Packages for Solution), search for Syncfusion.EJ2.AspNet.Core and then install it. Alternatively, you can utilize the following package manager command to achieve the same.

Install-Package Syncfusion.EJ2.AspNet.Core -Version 26.1.35


Syncfusion ASP.NET Core controls are available in Refer to NuGet packages topic to learn more about installing NuGet packages in various OS environments. The Syncfusion.EJ2.AspNet.Core NuGet package has dependencies, Newtonsoft.Json for JSON serialization and Syncfusion.Licensing for validating Syncfusion license key.

Add Syncfusion ASP.NET Core Tag Helper

Open ~/Pages/_ViewImports.cshtml file and import the Syncfusion.EJ2 TagHelper.

@addTagHelper *, Syncfusion.EJ2

Add stylesheet and script resources

Here, the theme and script is referred using CDN inside the <head> of ~/Pages/Shared/_Layout.cshtml file as follows,

    <!-- Syncfusion ASP.NET Core controls styles -->
    <link rel="stylesheet" href="" />
    <!-- Syncfusion ASP.NET Core controls scripts -->
    <script src=""></script>


Checkout the Themes topic to learn different ways (CDN, NPM package, and CRG) to refer styles in ASP.NET Core application, and to have the expected appearance for Syncfusion ASP.NET Core controls.


Checkout the Adding Script Reference topic to learn different approaches for adding script references in your ASP.NET Core application.

Register Syncfusion Script Manager

Also, register the script manager <ejs-script> at the end of <body> in the ASP.NET Core application as follows.

    <!-- Syncfusion ASP.NET Core Script Manager -->

Add ASP.NET Core TextBox control

Now, add the Syncfusion ASP.NET Core TextBox tag helper in ~/Pages/Index.cshtml page.

<div class="control-section">
    <div class="control_wrapper TextBox-control-section">
        <ejs-textbox id="firstname" placeholder="First Name"></ejs-textbox>

Press Ctrl+F5 (Windows) or +F5 (macOS) to run the app. Then, the Syncfusion ASP.NET Core TextBox control will be rendered in the default web browser.

ASP.NET Core TextBox Control

Adding icons to the TextBox

You can create a TextBox with icon as a group by creating the parent div element with the class e-input-group and add the icon element as span with the class e-input-group-icon. For detailed information, refer to the Groups section.

<div class="control-section">
    <div class="control_wrapper TextBox-control-section">
        <div class="e-input-group">
            <input class="e-input" name='input' type="text" placeholder="Enter Date" />
            <span class="e-input-group-icon e-input-popup-date"></span>
    var inputObject = {};
    var input = document.querySelectorAll('.e-input-group .e-input,.e-float-input.e-input-group input');
    var inputIcon = document.querySelectorAll('.e-input-group-icon');
    var focusFn = function (index) {
        return function () {
    var blurFn = function (index) {
        return function () { getParentNode(input[index]).classList.remove('e-input-focus'); };
    var mouseupFn = function () {
        var ele = this; setTimeout(function () {
        }, 500);
    for (var i = 0; i < input.length; i++) {
        input[i].addEventListener('focus', focusFn(i));
        input[i].addEventListener('blur', blurFn(i));
    for (var j = 0; j < inputIcon.length; j++) {
        inputIcon[j].addEventListener('mousedown', function () {
        inputIcon[j].addEventListener('mouseup', mouseupFn);
    function getParentNode(element) {
        var parentNode = element.parentNode;
        if (parentNode.classList.contains('e-input-in-wrap')) {
            return parentNode.parentNode;
        return parentNode;
    .e-input-group-icon:before {
        font-family: e-icons;

    .e-input-group .e-input-group-icon.e-input-popup-date { /* csslint allow: adjoining-classes */
        font-size: 16px;

    .e-input-group-icon.e-input-popup-date:before { /* csslint allow: adjoining-classes */
        content: "";

    .e-input-group-icon.e-input-up:before { /* csslint allow: adjoining-classes */
        content: '\e85e';


ASP.NET Core TextBox with Icon

Floating label

The floating label TextBox floats the label above the TextBox after focusing, or filled with value in the TextBox. You can create the floating label TextBox by using the floatLabelType API

<div class="control-section">
    <div class="control_wrapper TextBox-control-section">
        <ejs-textbox id="firstname" placeholder="First Name" floatLabelType="Auto"></ejs-textbox>

ASP.NET Core TextBox with Floating Label


View Sample in GitHub.

See also