开发者

asp:listbox how to provide data?

开发者 https://www.devze.com 2023-03-02 21:19 出处:网络
开发者_运维百科I\'m having some trouble within 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:list
开发者_运维百科

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消