我正在尝试使用 ASP:GridView 控件在我的网页上显示一些详细信息。因此,我添加了需要显示的列。但是,每列在 GridView 中显示两次(图片)。
后端代码如下:
objVendor = client.GetAllVenorsForPCMS();
if (objVendor.Count > 0)
{
gvVendorsDetails.DataSource = objVendor;
gvVendorsDetails.DataBind();
}
else
{
gvVendorsDetails.DataSource = null;
gvVendorsDetails.DataBind();
}
和aspx代码如下:
<div align="center" style="border: 1px solid;">
<asp:GridView ID="gvVendorsDetails" runat="server" CssClass="mGrid">
<Columns>
<asp:BoundField HeaderText="Vendor ID" DataField="VendorID" Visible="false" />
<asp:BoundField HeaderText="Vendor Name" DataField="VendorName" Visible="true" />
<asp:BoundField HeaderText="Vendor Description" DataField="VendorDescription" Visible="true" />
<asp:BoundField HeaderText="Address" DataField="Address" Visible="true" />
<asp:BoundField HeaderText="City" DataField="City" Visible="true" />
<asp:BoundField HeaderText="State" DataField="State" Visible="true" />
<asp:BoundField HeaderText="Country" DataField="Country" Visible="true" />
<asp:BoundField HeaderText="Contact Person" DataField="ContactPerson" Visible="true" />
<asp:BoundField HeaderText="Contact No" DataField="ContactNo" Visible="true" />
<asp:BoundField HeaderText="ZIP Code" DataField="ZIPCode" Visible="true" />
</Columns>
</asp:GridView>
</div>
我只添加了一次列,但是结果列如何显示两次!?