Tag: gridview

ASP.NET GridView Paging and Sorting

Author: | Categories: Programming No Comments
Below is the sample to include Sorting and Paging in ASP.Net GridView. ASPX Code <asp:GridView ID="grd" runat="server" AutoGenerateColumns="False" AllowSorting="true" OnSorting="grd_Sorting" AllowPaging="true" PageSize="50" OnPageIndexChanging="grd_PageIndexChanging"> Code Behind protected void grd_Sorting(object sender, GridViewSortEventArgs e) { try { mDT = GetData(); SetSortDirection(SortDirection); if (mDT != null) { mDT.DefaultView.Sort = e.SortExpression + " " + _sortDirection; grd.DataSource = mDT; grd.DataBind(); […]

Formatting ASP.net GridView

Author: | Categories: Programming No Comments
Formatting ASP.net GridView BoundField For Date and Time DataFormatString="{0:d-MMM-yyyy}" For Decimals DataFormatString="{0:F2}" For Currency DataFormatString="{0:C2}" For Percentage DataFormatString="{0:P2}"