Search results

Set the Read-only TextBox in ASP.NET MVC TextBox control

20 Jan 2022 / 1 minute to read

You can make the TextBox as read-only by setting the readonly attribute to the input element.

Copied to clipboard
<div class="control-section">
    <div class="control_wrapper accordion-control-section">
        <input class="e-input" type="text" placeholder="Enter Name" value="John" readonly />

        <div class="e-float-input">
            <input type='text' required readonly value="John" />
            <span class="e-float-line"></span>
            <label class="e-float-text e-label-top">Enter Name</label>

    // To get the all input fields and its container.

    var inputElement = document.querySelectorAll('.e-input-group .e-input,.e-float-input.e-input-group input');

    // Add 'e-input-focus' class to the input for achive ripple effect when focus on the input field.

    for (var i = 0; i < inputElement.length; i++) {
        inputElement[i].addEventListener('focus', function () {
        inputElement[i].addEventListener('blur', function () {

Copied to clipboard
public ActionResult Index()
    return View();