开发者

Align data of Itemtemplate inside Gridview

开发者 https://www.devze.com 2023-04-12 11:25 出处:网络
How can I align data inside the grid view. <asp:GridView ID=\"Gv\" runat=\"server\" AutoGenerateColumns=\"false\">

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

精彩评论

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