Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div>
- <br />
- <br />
- <style type="text/css">
- .mainpanel
- {
- display: block;
- border-left-width: 1px;
- border-left-color: Black;
- border-left-style: double;
- padding: 3px;
- float: left;
- }
- </style>
- <div style="" class="mainpanel">
- <div style="width: 245px; float: left; padding: 5px;">
- 1
- </div>
- <div style="width: 245px; float: left; padding: 5px;">
- 2
- </div>
- <div style="width: 245px; float: left; padding: 5px;">
- 3
- </div>
- <div style="width: 245px; float: left; padding: 5px;">
- 4
- </div>
- <div style="width: 245px; float: left; padding: 5px;">
- 5
- </div>
- <div style="width: 245px; float: left; padding: 5px;">
- 6
- </div>
- <div style="width: 245px; float: left; padding: 5px;">
- 7
- </div>
- <div style="width: 245px; float: left; padding: 5px;">
- 8
- </div>
- <div style="width: 245px; float: left; padding: 5px;">
- 9
- </div>
- </div>
- </div>
- div#multicolumn1 {
- -moz-column-count: 3;
- -moz-column-gap: 10px;
- -webkit-column-count: 3;
- -webkit-column-gap: 10px;
- column-count: 3;
- column-gap: 10px;
- }
- <div id=multicolumn1>
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas iaculis nisl nec nunc. Nam id lacus et lectus molestie tristique. Nunc vel risus consequat nisi vehicula cursus. Proin metus augue, cursus vitae, feugiat quis, porttitor ac, elit. Nulla et dui in mi laoreet auctor. Ut imperdiet nisl ut sem. Maecenas sodales magna eu neque. Nulla sagittis. Donec nec eros quis ligula condimentum scelerisque. Ut venenatis orci non odio. Duis mauris velit, sagittis sit amet, fringilla vel, ornare id, ipsum. Aenean et purus. Curabitur in massa. Morbi egestas nibh sed libero. Cras volutpat. Cras vitae nulla id urna consequat bibendum. Nunc bibendum ultricies orci. Cras id lorem. Pellentesque vel nisi. Nulla ligula eros, aliquet sed, vestibulum non, ultrices id, odio. </p>
- </div>
- <table cellpadding="2" cellspacing="0">
- <tr valign="top" >
- <td runat="server" id="TopTD">
- <asp:ListView ID="List" runat="server">
- <LayoutTemplate>
- <asp:PlaceHolder ID="itemPlaceHolder" runat="server"></asp:PlaceHolder>
- </LayoutTemplate>
- <ItemTemplate>
- <asp:literal runat="server" id="divdivide"
- visible='<%# eval("BreakFields") %>' Text='<%# eval("DivTag")%>'></asp:literal>
- <%# eval("Content")%>
- </ItemTemplate>
- <ItemSeparatorTemplate>
- </asp:ListView>
- </td>
- </tr>
- </table>
- </div>
- Function stringSize(ByVal strTarget As String, ByVal strFont As String, ByVal sngFontSize As Single) As SizeF
- strFont = "Arial, Sans-Serif"
- Dim bitImg As New Bitmap(1, 1)
- Dim g As Graphics = Graphics.FromImage(bitImg)
- Dim f As New Font(strFont, sngFontSize)
- Dim size As SizeF
- g.PageUnit = GraphicsUnit.Pixel
- size = g.MeasureString(strTarget, f)
- Dim I As Int32
- If Not String.IsNullOrEmpty(strTarget) Then
- Dim Re As New Regex(vbCrLf)
- I = Re.Matches(strTarget).Count
- End If
- If ColumnWidth > 0 Then
- size.Height = (size.Height * (Math.Ceiling(size.Width / ColumnWidth))) + (I * 20)
- size.Width = ColumnWidth
- Else
- size.Height = (size.Height * (Math.Ceiling(size.Width / DefaultSize))) + (I * 20)
- size.Width = DefaultSize
- End If
- g.Dispose()
- bitImg.Dispose()
- f.Dispose()
- Return size
- End Function
- Public ColumnWidth() As Int32
- Dim DT As New DataTable
- DT.Columns.Add("Content", GetType(Int32))
- DT.Columns.Add("Height", GetType(Int32))
- DT.Columns.Add("BreakFields", GetType(Boolean))
- Dim Row As DataRow
- For Each itemtodisplay
- Row = DT.NewRow
- Row("Content") = itemtodidisplay
- Row("Height") = 0
- Row("Height") += Fix(stringSize(itemtodisplay, "Arial", 10).Height)
- Row("Height") += 10
- HeightCounter += Row("Height")
- DT.Rows.Add(Row)
- Next
- BindItems(DT, Top, StartDate)
- Private Sub BindItems(ByVal DT As DataTable)
- If ColumnCount <= 0 Then
- ColumnCount = 1
- End If
- Dim I As Int32
- Dim HeightBreak As Int32 = (HeightCounter / ColumnCount) + 40
- Dim CurrentCol As Int32 = 1
- Dim Curheight As Int32
- I = 0
- Dim width As Int32
- If ColumnWidth > 0 Then
- width = ColumnWidth
- else
- width = DefaultSize
- End If
- If ColumnWidth > 0 Then
- TopTD.Width = width + 6
- DT.Columns.Add("DivTag", GetType(String))
- DT.Columns.Add("DivStyle", GetType(String))
- For Each Row In DT.Rows
- Row("DivStyle") = "width:" & width & "px; text-align:left;padding-bottom:3px;"
- If (Row("Height") + Curheight) > HeightBreak + 50 _
- And I > 0 _
- And ColumnCount > 1 _
- And CurrentCol < ColumnCount Then
- Row("BreakFields") = True
- Row("DivTag") = "</td><td width=" & width + 6 & ">"
- CurrentCol += 1
- Curheight = 0
- Else
- Row("BreakFields") = False
- End If
- I += 1
- Curheight += Row("Height")
- Next
- StoryList.DataSource = DT
- StoryList.DataBind()
- End Sub
Add Comment
Please, Sign In to add comment