.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Paging on a different column than the sorting column

Posted By:      Posted Date: September 26, 2010    Points: 0   Category :ASP.Net


Situation: SQL database, Linq to SQL class a ASP.NET page with a LinqDataSource and a gridview.

The table has a ID field, a date field and a Serialnr field.

In my Grid I like to Page on the datefield but to sort on the serialnr field ( or a selectable other field).

Is that possible? Standard the paging is always done on the sort field and when you select a different sort field the page jumps back to the first page., and paging is then done over that sorted column.



View Complete Post

More Related Resource Links

Modified column missing when sorting


I resently updated few document libraries on my sharepoint site.  What I did I removed "Content approval" from those libraries and now my modified and created columns are missing from the columns of the list (appear to be hidden ).  So, I need to be able to sort by these columns and I have seen many people asking about this same question but I haven't found any answer to this issue.  The columns are still there but I they dont show up in the columns of the library.  I can still create a view with this columns but i cant sort by them.

Is this a bug or is there a reason why sharepoint does this? 


Sorting a DVWP by Column Total

I have a survey list in Sharepoint 2007, which from what I understand means I can't add a calculated column. In this survey list I have some number columns that need to be calculated for display. They are: (1) Number of Weeks, (2) Number of Hours per Week, and (3) Number of Hours for Credit. In Sharepoint Designer, I've created a Data View Web Part which displays those columns and two additional "calculated columns." Scare quotes because the calculation is happening in the XSL of the web part, not an actual calculated column. These columns are (4) Number of Hours (Column1*Column2) and (5) Eligible Hours (Column1*Column2-Column3). I have the data view grouped by @Author (Created By) and a column total row for each group. I even figured out how to get column totals for all four columns though the nodeset is grouped by Author, which breaks out of the box. Great, beautiful. The final step is sorting the entire view by the column total of Column5. In other words, I want my groups of @Authors listed in descending order by their Total Eligible Hours. Is this possible?

Up Down GridView Icon Image for Column Sorting

I'm trying to add an Ascending and Descending sort direction Icon Image next to the header text of my ASP.NET 2.0 Gridview Columns.I've searched and found some examples that seem to do this but have had difficult time recoding them from C# to VB or some just seemed overly complex for what I want to do.Does anyone have a simple VB solution for sort icons?Thanks,Ethan   

How to revert the column header sorting in DataGridView



I want to get the old state (lets say datagridview default state) of grid after sorting is done. How can I achive this.

Please suggest.

Please remember to click 'Mark as Answer' on the post that helped you.

Datagrid column Sorting generating error


I have a datagrid column whose column values are databinded. I have used DataGridTemplateColumn and i need to use the sorting in this column.

<my:DataGridTemplateColumn SortMemberPath="FileName" Header="Name" IsReadOnly="True" MinWidth="150">

It works and sort the the data but when i edit the data after sorting, i need to re-generate the columns data.

FileListingGrid.ItemsSource = listFiles1;

But this generates "'Sorting' is not allowed during an AddNew or EditItem transaction. "

It works file when column data is not sorted but whenever i sort the data and have to re-generate the column data, it throws the following error.


DataGrid - how to make Column sorting dynamic, to cater for when bound data changes?

I'm using a DataGrid in a VS2010 WPF C# project.  I have bound the DataGrid to an ObservableCollection<SummaryItem>.  When you click on a column heading it sorts the data at that point in time.

Question - How would I arrange such that the sorting in the DataGrid is dynamic, so that when data changes (within the ObservableCollection<SummaryItem>) the sorting keeps working.

Notes: Binding approach is via DataGrid

      private ObservableCollection<SummaryItem> _summaryData = new ObservableCollection<SummaryItem>();
      SummaryDataGrid.ItemsSource = _summaryData;
      SummaryDataGrid.AutoGeneratingColumn += (s, e) =>
        //if (e.Column.Header.ToString() == "ProcessName")
        //  e.Column.Width = new DataGridLength(1, DataGridLengthUnitType.Star);
        e.Column.Width = new DataGridLength(1, DataGridLengthUnitType.Star);
  public class SummaryItem : INotifyPropertyChanged
    public event PropertyChangedEvent

Sorting AlphaNumeric column in DataView.


I have a sorting issue with DataView.

I have one column in DataSet's Databale of String type. This column is of "String" type. I can not change it to Integer, although I know that there will always be "Numeric Data" in this column.
I am getting problem on sorting of this column. I want to sort it 'numerically', but it sorts as 'alpha-numeric'.
dv (is my DataView object)

Sorting on column take time while using Row_number()


when I use 'RowNumber' = ROW_NUMBER() OVER(ORDER BY ColumnName)  then due to orderby Column name consume 76% usage. in such case what I have to do? I can see sorting taking much time in execution plan. 

AJAX GridView Paging and Sorting using C# in ASP.Net

To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

Tooltip for GridView Column Headers (ASP.Net)

I just wanted to add auto tooltips for my GridView headers. There are couple of ways but I don't want to use javascript and wanted to use simple 'title' attribute. It took couple of hours to get the working code supporting sortable columns. I thought it will be very useful for others. Here's the code and logic behind it.

GridView Sorting/Paging : 'REAL' AJAX with Asp.Net Series

This is a continuation of my 'REAL' AJAX with Asp.Net (not Asp.Net AJAX) series posts for those of us trying to stop relying on Asp.Net 'AJAX'.

Ok, nothing too dramatic to start things off, we are going to make some tabled data sortable and pagable all without using a bit of postback. Not only that, but it is going to be incredibly easy!

Multiple Column Dropdownlist for the ASP.NET DataGrid

Based on my previous control "Multiple Column DropDownList for ASP.NET", I received many emails asking for the same control to be used in the DataGrid for web applications. Here we go.. This control can be used as the regular MS DropDownList in the DataGrid and also as a regular dropdownlist. It has all the properties, like DataTextField, DataValueField, DataSource, SelectedIndex etc. The download file contains the samples both in VB.NET and C#. In this sample, I have used the Northwind database of SQL Server.

Manually sorting and paging Gridview without using datasource control

Many a times while working with Gridview we want to work with the paging and sorting functionality without using any datasource control. Gridview is flexible enough to perform these tasks without the use of any datasource control and only a few lines of code.

Optimized Paging and Sorting in ASP.NET GridView

In this article I am going to demonstrate what are the performance drawbacks of using conventional way to page and sort your GridView and then I will demonstrate 'An Optimized way to implement Paging and Sorting'.

Alternating row background for first column of a report


is there a way to make the first column of a report use the an alternating background color? 

I have the background color set for the entire row however it does not work for the first column if the color is set to an expression.  If I just set it to a color i.e. red it works just fine. If I insert a dummy column to the left it works just fine (but the dummy column does not work, presumably because it is first??).

In the file below only the textbox for part number does not show an alternating background.  All others work correctly.

                    <Textbox Name="PartNumber">

Use a column as parameter for a sds in another column; gridview


Hola, I have a gridview which is bound to a sds which returns 7 columns and I added two columns from the GUI.  What I want is to fill up the 9th column with DDLs and these  DDLS will get their data from a different sds which is using a stored procedure with a single parameter.  I created the 9th row, used template field, made the sds for 9th row, the stored_procedure, threw a DDL in Item template and all  I need now is to pass a parameter in the first column to the sds in the 9th column.  I can code this but i'm getting tired of aspx.cs :) and would like to do it from the GUI.

Pass a grid column value to a Modal


Hi, I have a requirement to hide a field called details on a gridview and show it in a jQuery modal dialog when users click on the Customer ID hyperlink. This grid is created programmatically. I will be hiding the details column via the CSS display:none property. Does some one know how can I pass the grid's selected hidden column value to the modal? Here is some of the code I started:

            GridView mygrid = new GridView();
            //.....................................More columns code for the grid

            //Here is where I need to pass the Details column value associated with the customer ID field selected to the Modal and open the Modal dialog.            
            HyperLinkField linkField = new HyperLinkField();
            string[] dataNavigateUrlFields = { "CustomerID" };
            linkField.DataTextField = "CustomerID";

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend