0

I'm having some trouble with in my MVC-View. The data for the listbox is passed by the controller and accessible via Model.templateList. So now I have to pass these data to the asp:listbox. Is there any way to do this or do I have to use some sort of DataProvider. What would be bad in terms of SoC. I considered using the Html-Helper Html.ListBox but I have no idea how to get actions like double-click and so on to work with it. Hope there are many smart people with some knowledge about this.

Thank you for reading

Benjamin
  • 3
  • 1

1 Answers1

0

To bind to the list box you would using something like this

@Html.ListBox("ListBoxName", new SelectList(Model,"dataValueField", "dataTextField"));

with regards to the the actions you would need to use JavaScript. A google query like "listbox double click javascript" will help you get to the next level.

Geovani Martinez
  • 2,053
  • 2
  • 27
  • 32
  • Thank you so far but that was what I already managed to get to work. The Problem is to get the dblClick event and call the javascript. My google search does not help me with that. All I'm finding are solutions that base on code-behind and since I'm on a html page... – Benjamin May 05 '11 at 14:46
  • Just found it. <%= Html.ListBox("templateList", Model.templateList, new { @class = "listbox", @onDblClick = "loadTemplateToTextBox(this.value)" })%> – Benjamin May 05 '11 at 14:55