daveaglick / FluentBootstrap

Provides extensions, helper classes, model binding, and other goodies to help you use the Bootstrap CSS framework from .NET code.
http://www.fluentbootstrap.com
MIT License
200 stars 76 forks source link

How to apply style to the list items (the <li ..>) that is generated (@Html.Bootstrap().ListFor) #60

Closed dm7777 closed 8 years ago

dm7777 commented 8 years ago

Hello

I am trying apply styles to the list items generated by @Html.Bootstrap().ListFor

It applys the CSS style correctly to the UL it generates to contain the LI

This need has come becuase I am trying to use this in conjunction with Bootstrap HTML5 Sortable jQuery Plugin at https://github.com/psfpro/bootstrap-html5sortable which requires it have a class for the LI to be properly styled

I am using asp.net mvs razor and the model is passed into the View via my controller

Many thanks in advance

dm7777 commented 8 years ago

Hi

I figured out how to achieve the effect by using the following:

@using (var listGroup1 = @Html.Bootstrap().ListGroup().AddCss("", "list-group list-group-sortable-connected").SetId("sortable3").Begin())
                {

                    foreach (var item in Model.MyDataList)
                    {
                        @listGroup1.ListGroupItem(item.Text).AddCss("", "list-group-item list-group-item-info")
                    }
                }

Thanks

daveaglick commented 8 years ago

:thumbsup: Glad you were able to figure it out - just let me know if you have any other questions.