Hi I have something like this in my code :
`
<div>Room:@Html.TextBox("RoomID")</div>
<div>Nume:@Html.TextBox("FirstName")</div>
<div>Prenume:@Html.TextBox("LastName")</div>
<div>Telefon:@Html.TextBox("Phone")</div>
<div>Data Nasterii:@Html.TextBox("Birthday")</div>
<h3>Address</h3>
<div>Tara:@Html.TextBox("Tara")</div>
<div>Oras:@Html.TextBox("Oras")</div>
<div>Judet:@Html.TextBox("Judet")</div>
<div>Strada:@Html.TextBox("Strada")</div>
<div>tipclient:@Html.TextBox("GuestTypeId")</div>
<div>Data In:@Html.TextBox("Data_Check_in")</div>
<div>Data OUT:@Html.TextBox("Data_Check_out")</div> `
How can i make this <div>Room:@Html.TextBox("RoomID")</div> invisible for Client side or how to make it readonly?
You could use a hidden field:
or if you want to make it visible to the client but readonly:
or using the strongly typed versions which obviously are preferred:
or:
or if you want to use a hidden field yet another possibility is to decorate your view model property with the
[HiddenInput]attribute:and in your view simply use an editor template:
But no matter what you do or choose please use view models and strongly typed versions of those helpers.