Click here to Skip to main content
15,667,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i m getting total 10 columns in a row from db...

i want to show 5 columns in one row n other 5 in another row in gridvew..

i m having multiple rows returned frm db..

how to do???

i m creating web app.
Updated 31-May-12 8:39am

1 solution

This behavior is typical of a listview.
You can solve using a listview like this:
    ListView split row</h3>
<asp:listview id="ListView2" datasourceid="SqlDataSource2" xmlns:asp="#unknown">
    ItemPlaceholderID="ContactItemContainer" runat="server">
        <table cellpadding="4" width="640px" runat="server" id="tblContacts">
            <tr id="Tr1" runat="server">
                <th id="Th1" colspan="3" runat="server">
            <tr runat="server" id="ContactItemContainer" />
        <asp:datapager id="ContactsDataPager" runat="server" pagesize="30">
                <asp:numericpagerfield buttoncount="10" />
            <td id="Td8" class="item" runat="server">
                <asp:label id="Label2" runat="server" text="<%# Eval("TitleOfCourtesy") %>" />
            <td id="Td5" class="item" runat="server">
                <asp:label id="NameLabel" runat="server" text="<%# Eval("LastName") %>" />
            <td id="Td7" class="item" runat="server">
                <asp:label id="Label1" runat="server" text="<%# Eval("FirstName") %>" />
            <td id="Td9" class="item" runat="server">
                <asp:label id="Label3" runat="server" text="<%# Eval("Title") %>" />
            <td id="Td10" class="item" runat="server">
                <asp:label id="Label4" runat="server" text="<%# Eval("City") %>" />
            <td id="Td11" class="item" runat="server">
                <asp:label id="Label5" runat="server" text="<%# Eval("Country") %>" />
        <tr style="height:1px;">
        <td colspan="3" style="border-top: 1px solid #00C0C0; height:1px;">
<asp:sqldatasource id="SqlDataSource2" runat="server" connectionstring="<%$ ConnectionStrings:Northwind %>" xmlns:asp="#unknown">
    SelectCommand="SELECT [FirstName], [LastName] , [Title], [TitleOfCourtesy], [City], [Country]
        FROM Employees ORDER BY [LastName], [FirstName] "></asp:sqldatasource>
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900