Click here to Skip to main content
13,708,573 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"
Posted 23-Oct-16 20:54pm
Updated 23-Oct-16 22:21pm
Comments
khezerloo 8-Jan-18 15:32pm
   
ll

1 solution

Rate this: bad
 
good
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.
  Permalink  

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
Web01-2016 | 2.8.180920.1 | Last Updated 24 Oct 2016
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

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