Last post Apr 25, 2018 08:52 AM by Yohann Lu
Apr 24, 2018 07:21 PM|Ramjee|LINK
I need to sort using header and also export to MS Excel.
Dim sQuery As String = GetSearchQuery
' My query is select SAMPLE_NO_1, SAMPLE_NO_2 , SAMPLE_NO_3 , SAMPLE_NO_4, SAMPLE_NO_5 from Sample_Table (it has 50 fields)
Dim cmd As New OracleCommand
cmd.Connection = OraConn
cmd.CommandText = sQuery
cmd.CommandType = CommandType.Text
'Create and fill data adaptor
Dim da As OracleDataAdapter
da = New OracleDataAdapter(cmd)
'Create and fill data set
Dim dt As New DataTable
dgvSearchResults.Visible = True
dgvSearchResults.DataSource = dt
Thanks a lot.
Apr 25, 2018 08:52 AM|Yohann Lu|LINK
I need to sort using header
If you are using a standard ASP.NET System.Web.UI.WebControls.GridView. The GridView control provides built-in sorting without coding, you can simply "Enable Sorting" by setting "AllowSorting" to true. You can further customize the sort function of the GridView
control by setting the custom SortExpression attribute values for the column and using the Sorting and Sorted events.
Paging and Sorting in ASP.Net GridView example
export to MS Excel.
Please refer the following sample.
Export GridView to Excel in ASP.Net with Formatting using C# and VB.Net: