c# - Adding disabled attribute to a button using Razor -



c# - Adding disabled attribute to a button using Razor -

i have bool in viewmodel called disablenextbutton , utilize disable button in view. should add together button lives within if statement.

ultimately, i'm trying add together disabled attribute when disablenextbutton true.

here's unsuccessful implementation:

@if(true) { <button type="button" @{ if (model.disablenextbutton) { <text>disabled="disabled"</text> } } >next</button> }

i should note gives me functioning enabled button.

translated this post:

<input type="button" value="next" @{ if(model.disablenextbutton) { @:disabled="disabled" } } />

basically, <text> tag unnecessary, not text, it's html attribute.

c# asp.net-mvc razor

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -