Tuesday, June 28, 2022

Datefield ASP.NET C# GridView

 <asp:GridView ID="GridView1" runat = "server" AutoGenerateColumns="false">

    <Columns>
        <asp:BoundField DataField="Id" HeaderText="Customer Id" ItemStyle-Width="100px" />
        <asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="120px" />
        <asp:TemplateField HeaderText="Birth Date" ItemStyle-Width="120px" >
            <ItemTemplate>
                <asp:Label Text='<%# Eval("BirthDate", "{0:dd, MMM yyyy}") %>' runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

No comments:

Post a Comment