Click here to Skip to main content
13,900,110 members
Rate this:
Please Sign up or sign in to vote.
Im having trouble disabling or set textbox to readonly after postback submission.
what code do i need from controller to disable a razor textbox in views.
please dont suggest to use jquery for me to familiarize mvc thanks.

What I have tried:

i can do this by default but cant control the properties of the textbox in the c# controller.
<input id="Name" name="Name" type="text" value="@Model.listovariableclass" disabled="disabled"
Updated 23-Oct-16 22:21pm
khezerloo 8-Jan-18 15:32pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

MVC is a server-side technology, you can't use it to dynamically amend the DOM in the browser, so I'm afraid you're going to have to use javascript or jQuery to do this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.190306.1 | Last Updated 24 Oct 2016
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100