开发者

Align data of Itemtemplate inside Gridview

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>

Align data of Itemtemplate inside 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜