tags:

views:

7

answers:

2

how can i disable the list box

Html.ListBox("Organization", Model.OrgListbox as MultiSelectList)
+1  A: 

You use the htmlAttributes parameter:

Html.ListBox("Organization", Model.OrgListbox as MultiSelectList, new { disabled = "disabled" })
veggerby
+1  A: 

If you want to add the disabled attribute to the HTML then you would do this:

Html.ListBox("Organization", Model.OrgListbox as MultiSelectList, new { disabled = "disabled" })

This calls the overload of Html.ListBox where you can specify htmlAttributes that are added to the rendered HTML.

Alternatively you could use jQuery, doing something like this:

$("#controlId).attr("disabled","disabled");
Dan Diplo
ok thanks jquery is also a good idea
mazhar kaunain baig