Question: Our client requires a view only form (making controls as readonly is not an acceptable solution :-( ) which displays the value of the text box / drop down / List box (comma delimited values) as label when the user has readonly access to that form. Is there a Jquery plugin which would do this? I don't want to create a separate set of partial views to accomplish this.

Any help in this regard is much appreciated.

Thanks,

Raja

Answer: 
Yes, you can. I don't advise it.

Declare your helpers with a css class so you can grab them all with a JQuery selector

```
@Html.TextBox("txtName", "20", new { @class = "cssChange" })

```

Use JQuery to change their form to Labels

```
$( ".cssChange" ).replaceWith( function() {
    return "<input type=\"label\" value=\"" + $( this ).html() + "\" />";
});

```

My code was not *tested*. It is purely instructive.

And I recommend against it. I would instead recommend another div with labels and a toggle. But this option is available. good luck.
```
    public static MvcHtmlString EditorOrDisplayFor<TModel, TProperty>(
        this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression,
        bool canEdit, int boxWidth = 100)
    {
        var sb = new StringBuilder();

        if (canEdit)
        {
            var editor = htmlHelper.TextBoxFor(expression, new { style = "width: " + boxWidth + "px;" });
            sb.AppendFormat("<div class=\"TextEditor\">{0}</div>", editor);
        }
        else
        {
            var lbl = htmlHelper.LabelFor(expression);
            var hid = htmlHelper.HiddenFor(expression);
            sb.AppendFormat("<div class=\"CanNotEdit\">{0}{1}</div>", lbl, hid);
        }
        return MvcHtmlString.Create(sb.ToString());
    }

```