How can I align data inside the grid view.
<asp:GridView ID="Gv" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label id="Name" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date">
开发者_运维技巧 <ItemTemplate>
<%# String.Format("{0:MM/dd/yyyy}", DataBinder.Eval(Container.DataItem, "Date")) %>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
In your question you have both gridview and aspxgridview tags. Anyway, I have answers for both tag.
For Gridview:
Use GridView.RowStyle
property and set :horizontal-align
For ASPxGridview:
Use CellStyle
property like;
<dxwgv:GridViewDataTextColumn ...>
<CellStyle HorizontalAlign="Left" />
</dxwgv:GridViewDataTextColumn>
精彩评论