A day with .Net

My day to day experince in .net

Binding formated data to gridview by Bind()

Posted by vivekcek on July 22, 2009

<asp:GridView ID="ccGvAdv" runat="server" AutoGenerateColumns="False" CellPadding="4"
                            CssClass="grid" DataKeyNames="ccr_CurrencyExchangeRateID" GridLines="None" Width="100%"
                            AllowPaging="True" OnPageIndexChanging="ccGvAdv_PageIndexChanging" OnRowDataBound="ccGvAdv_RowDataBound">
                            <PagerSettings NextPageText="NextPage" PreviousPageText="PreviousPage" />
                                <asp:BoundField DataField="cur_Name" HeaderText="Currency" />
                                <asp:TemplateField HeaderText="Updated Date&amp;Time">
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("ccr_DateTime","{0:dd MMM-yyy HH:mm:ss}") %>'></asp:Label>
                                <asp:TemplateField HeaderText="Original Rate">
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("ccr_OriginalRate","{0:#.##}")  %>'></asp:Label>
                                <asp:TemplateField HeaderText="ISV Charges">
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("InterserveCharge")  %>'></asp:Label>
                                <asp:TemplateField HeaderText="Summed Rate">
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("ccr_Rate","{0:#.##}")  %>'></asp:Label>
                            <AlternatingRowStyle CssClass="grid_row_alternate" />
                            <HeaderStyle CssClass="grid_row_header" />
                            <FooterStyle CssClass="grid_row_footer" />
                            <RowStyle CssClass="grid_row_normal" />
                            <PagerStyle CssClass="grid_row_pager" />

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s