Well, a list view can be considered to have columns.
That means you are free to add columns, or move columns around.
So, say I have this layout template:
So, code to load, say this:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
LoadGrid()
End If
End Sub
Sub LoadGrid()
Dim strSQL As String = "SELECT * FROM Fighters"
ListView1.DataSource = MyRst(strSQL)
ListView1.DataBind()
End Sub
Public Function MyRst(strSQL As String) As DataTable
Dim rstData As New DataTable
Using conn As New SqlConnection(My.Settings.TEST4)
Using cmdSQL As New SqlCommand(strSQL, conn)
conn.Open()
rstData.Load(cmdSQL.ExecuteReader)
rstData.TableName = strSQL
End Using
End Using
Return rstData
End Function
And now we get/have this:
So, in above, we have 5 columns.
But lets do the opposite of what you are asking. lets move the Fighter name over to the image preview column, and delete the column. (so, adding columns, or deleting them is the lesson here).
but, say I wanted to move the fighter "name" to the first column - say above the picture. So, I just move the content from the 2nd column, to the first, delete the 2nd column. I now have this markup:
so the first two columns of markup in the template was this:
But, lets move the content for 2nd row to the first, say like this:
And now we remove the extra row in layout template, and have this:
And the result is thus this:
so, as above shows, you are free to add extra columns (your goal), or remove and combine columns of data. In effect, just reverse the steps above from that last example, to the first - in other words, ADD SOME columns to the layout template, and move the content into those extra columns you desire.
So, my final layout of the listview is now this:
so we can add more columns, or remove columns and combine the content into one column.
Regards,
Albert D. Kallal (Access MVP 2003-2017)
Edmonton, Alberta Canada