开发者

Data Displayed Twice In Gridview (ASP.NET)

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], [P开发者_JAVA百科ackageName], [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


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">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜