0
votes

I have a dataset,where each row has 3 columns title,link and description. This has to be binded to Gridview. When binded to Gridview the result is displayed as Title Link Description ( that is in one row, all three values are displayed for one dataset row)

I need the result to display in

    Title               
    Link
    Description

namely, i need the result to be displayed row-wise.

Can someone please tell me how to implement it.

1

1 Answers

0
votes

You can do this by using templatefield.

<asp:GridView ID="GridView1" runat="server" ShowHeader="false">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <table>
                    <tr>
                        <td>
                            Title
                        </td>
                        <td>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("title") %>'></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Link
                        </td>
                        <td>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("link") %>'></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Decsription
                        </td>
                        <td>
                            <asp:Label ID="Label3" runat="server" Text='<%# Bind("description") %>'></asp:Label>
                        </td>
                    </tr>
                </table>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>