views:

31

answers:

2

Hi all,

I'm using asp.net mvc-2 and would like to know if there's a way to create a listbox with a checkboxlist inside of it?

+1  A: 

I would recommend using a div styled like a listbox then you can have whatever you want in there.

<div style="overflow:auto;border:1px solid #336699;padding-left:5px">
  $$$WHATEVER YOU WANT$$$
  <%= Html.ListBox(“WhateverYouWant”, Model.WhateverList) %>
</div>

binds something like

var testList = new List<SelectListItem>();

//add SeleectListItems to testList

ViewData["WhateverYouWant"] = testList;
jumpdart
sorry but how would i bind my data to the checkboxlist? not too familiar with MVC.
hersh
something like in the answer edit... more experienced with css then MVC though =(
jumpdart