views:

21

answers:

2

Hi,

I'm trying to make a page where information from the database are displayed on a page. For this, I'm using a Gridview control. The data displays fine, but it displays the same information twice. So basically, two tables are drawn by ASP and placed side by side.

Heres the code I'm using:

<asp:GridView ID="PackagesGV" runat="server" Width="520px">
    <Columns>
        <asp:BoundField DataField="ID" HeaderText="Package ID"/>
        <asp:BoundField DataField="PackageName" HeaderText="Package Name"/>
        <asp:BoundField DataField="PackageText" HeaderText="Package Text"/>
        <asp:BoundField DataField="PackageImageID" HeaderText="Package Image"/>
        <asp:BoundField DataField="PageID" HeaderText="Page ID"/>
    </Columns>
</asp:GridView>

Also, the SQL Stored Procedure is pulling all of the fields required by the Gridview. The SQL is basically

"SELECT [ID], [PackageName], [PackageText], [PackageImageID], [PageID] FROM [Packages]"

So I'm not requesting the information twice using the Stored Procedure.

I've started ASP.NET in July, so I apologise now if this is something really simple.

Thanks! Michael

+1  A: 

You need to either set the GridView.AutoGenerateColumns Property to false or not set up the columns.

If you choose the former method your grid definition will become:

<asp:GridView ID="PackagesGV" runat="server" Width="520px" AutoGenerateColumns="False">
ChrisF
Hey, just tried it and it's worked. Thank you very much!
mickburkejnr
A: 

Can you please show tour databinding code and the table structure that contains data?

Lorenzo
This isn't an answer - it's a comment.
ChrisF