【发布时间】:2015-04-03 02:05:48
【问题描述】:
我有一个 gridview 控件,用于显示数据集中的记录。数据集包含根据需要填充空格的记录。我正在尝试遵循这篇文章中的解决方案programatically change style (padding) of a column in 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>
【问题讨论】: