问题
My GridView in only single column, how can I make it multicolumn?
There isn't an option to set column number in GridView properties.
Update :
回答1:
Because it can be difficult to get a table with 4 columns in a Repeater, here a little example.
<table border="1">
<tr>
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<%# Container.ItemIndex %4 == 0 && Container.ItemIndex > 0 ? "</tr><tr>" : "" %>
<td><%# Eval("column") %></td>
</ItemTemplate>
</asp:Repeater>
</tr>
</table>
回答2:
You cannot display GridView rows horizontally. A gridview is essentially an html table with each record displayed as new table row. You can try using a ListView or a Repeater to accomplish what you're trying to do.
来源:https://stackoverflow.com/questions/45511605/how-to-make-gridview-multicolumn-in-asp-net