jm1234
June 7th, 2006, 09:41 AM
Hi,
In my columns, I'm trying to get the header text to be centered, but the HeaderStyle-HorizontalAlign attribute does not seem to be working. It doesn't matter what I set it to, it's always aligned to the left of the cell. Is this a Visual Studio 2005 Pro bug? Thanks!!!
Here is my gridview code (my gridview is bound to an arraylist of my custom business object in my codebehind):
<asp:GridView runat="server" ID="UserCustomerGrd" DataKeyNames="CustomerID"
AllowPaging="true" PageSize="10" AutoGenerateColumns="false"
cssClass="ColorTableBackground" CellSpacing="0" CellPadding="3"
BorderStyle="Solid" BorderColor="Black" EditIndex="-1"
HeaderStyle-CssClass="ColorHeaderBackground ColorHeaderTextColor">
<Columns>
<asp:TemplateField HeaderText="Delete" HeaderStyle-Font-Bold="false" HeaderStyle-BorderColor="Black"HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-BorderColor="Black" ><ItemTemplate><asp:LinkButton ID="DelBtn" OnClientClick="javascript:return confirm('Are you sure you wish to delete?')" CommandArgument='<%#Eval("CustomerID")%>' CommandName="DeleteCust" runat="server">Delete</asp:LinkButton></ItemTemplate></asp:TemplateField>
<asp:BoundField DataField="CustomerID" HeaderText="Customer ID" HeaderStyle-Font-Bold="false" HeaderStyle-BorderColor="Black" HeaderStyle-HorizontalAlign="Center" ItemStyle-BorderColor="Black" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Name" HeaderText="Customer Name" HeaderStyle-Font-Bold="false" HeaderStyle-BorderColor="Black" HeaderStyle-HorizontalAlign="Center" ItemStyle-BorderColor="Black" />
</Columns>
<PagerSettings Mode="NumericFirstLast" LastPageText="Last" FirstPageText="First" />
<PagerStyle HorizontalAlign="Center" />
</asp:GridView>
In my columns, I'm trying to get the header text to be centered, but the HeaderStyle-HorizontalAlign attribute does not seem to be working. It doesn't matter what I set it to, it's always aligned to the left of the cell. Is this a Visual Studio 2005 Pro bug? Thanks!!!
Here is my gridview code (my gridview is bound to an arraylist of my custom business object in my codebehind):
<asp:GridView runat="server" ID="UserCustomerGrd" DataKeyNames="CustomerID"
AllowPaging="true" PageSize="10" AutoGenerateColumns="false"
cssClass="ColorTableBackground" CellSpacing="0" CellPadding="3"
BorderStyle="Solid" BorderColor="Black" EditIndex="-1"
HeaderStyle-CssClass="ColorHeaderBackground ColorHeaderTextColor">
<Columns>
<asp:TemplateField HeaderText="Delete" HeaderStyle-Font-Bold="false" HeaderStyle-BorderColor="Black"HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-BorderColor="Black" ><ItemTemplate><asp:LinkButton ID="DelBtn" OnClientClick="javascript:return confirm('Are you sure you wish to delete?')" CommandArgument='<%#Eval("CustomerID")%>' CommandName="DeleteCust" runat="server">Delete</asp:LinkButton></ItemTemplate></asp:TemplateField>
<asp:BoundField DataField="CustomerID" HeaderText="Customer ID" HeaderStyle-Font-Bold="false" HeaderStyle-BorderColor="Black" HeaderStyle-HorizontalAlign="Center" ItemStyle-BorderColor="Black" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Name" HeaderText="Customer Name" HeaderStyle-Font-Bold="false" HeaderStyle-BorderColor="Black" HeaderStyle-HorizontalAlign="Center" ItemStyle-BorderColor="Black" />
</Columns>
<PagerSettings Mode="NumericFirstLast" LastPageText="Last" FirstPageText="First" />
<PagerStyle HorizontalAlign="Center" />
</asp:GridView>