Bengi Besceli
Bengi Besceli

Reputation: 3748

How to make GridView multicolumn in Asp.Net

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 :

The GridView I have

Upvotes: 0

Views: 342

Answers (2)

VDWWD
VDWWD

Reputation: 35514

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>

Upvotes: 1

boruchsiper
boruchsiper

Reputation: 2028

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.

Upvotes: 0

Related Questions