我有一个 gridview 控件,我在其中显示数据集中的记录。数据集包含根据需要填充空格的记录。我正在尝试按照这篇文章中的解决方案以编程方式更改 ASP.NET GridView 中列的样式(填充)
但是,当我在 gridview 中显示它们时,记录显示为左对齐。
如何显示空格填充记录?
<asp:GridView runat="server" ID="gvCustomer" Visible="false"
Width="350px" CellSpacing="1" ClientIDMode="Static" CellPadding="2"
AutoGenerateColumns="false" OnRowDataBound="gvCustomer_OnRowDataBound"
ViewStateMode="Enabled" EmptyDataText="">
<Columns>
<asp:BoundField DataField="CustomerName" ControlStyle-Width="225px" HeaderStyle-HorizontalAlign="Center" HeaderText="Customers" />
</Columns>
</asp:GridView>