locked
'Wrap' Webgrid Columns within DIV RRS feed

  • Question

  • User927770920 posted

    Silly question time (?)

    Is it possible to wrap Webgrid columns within it's containing DIV (i.e. force a HTML </br> after given column)?

    So, I have 10 columns and want the second 5 to drop under the first five.

    Thursday, August 7, 2014 5:22 AM

Answers

  • User927770920 posted

    Sorted it if anyone else is looking to achieve a similar result.

    I have split the webgrid into 4 DIVs (which I wasn't sure was possible) as below:

    <div class="container">                        
                @grid.GetHtml(
                htmlAttributes: new {id = "tableData1"},
                tableStyle : "table",
                alternatingRowStyle : "alternate",
                selectedRowStyle: "selected",
                headerStyle : "head", 
                columns : grid.Columns(
                      grid.Column(col1),
                      grid.Column(col2),
                      grid.Column(col3),
                      grid.Column(col4),
                      grid.Column(col5)
                ))
    </div>
    <div class="container">                        
                @grid.GetHtml(
                htmlAttributes: new {id = "tableData2"},
                tableStyle : "table",
                alternatingRowStyle : "alternate",
                selectedRowStyle: "selected",
                headerStyle : "head", 
                columns : grid.Columns(
                      grid.Column(col6),
                      grid.Column(col7),
                      grid.Column(col8),
                      grid.Column(col9),
                      grid.Column(col10)
                ))
    </div>

    etc...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 7, 2014 5:57 AM