views:

147

answers:

1

Hello,

I have a series of pages (in a wizard type application). After collecting user's inputs here and there, I'd like to display a summary in a single page. I don't want the users to modify information on that page, just to visualize them. Otherwise, he they go back to the prevoius pages to do so.

To obtain that, I use Html.Encode(Model.field) to replace textbox. But I don't want to replace checkboxes and radiobuttons; I'm gonna need to disable them. But,

How do I disable Radiobutton and checkboxes when using HtmlHelper methods?

<%Html.CheckBox("MyCheckBox")%>

or

<%Html.RadioButton("MyRadioButton")%>

Thanks for helping

+5  A: 

Add the HTML attribute disabled:

<%: Html.CheckBox("MyCheckbox", new { disabled = "disabled" }) %>
<%: Html.RadioButton("MyRadioButton", value, new { disabled = "disabled" }) %>
Julien Lebosquain
@Julien Lebosquain: I've learn also how to talk to Html from your answer. In case you speak french: Merci, je m'attendais pas a retrouver des francophones dans ce site. Et bien, c'est fait.
Richard77