Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1034461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:23:45+00:00 2026-05-16T14:23:45+00:00

I have a sortable DatagridView with a summary last row containing sum of some

  • 0

I have a sortable DatagridView with a summary last row containing sum of some columns, i want to keep this summary row always as the last line(bottom) of datagridView.

At the moment, when i sort a column of datagridView also the summary row get sorted, i don’t want this. I want to keep the last row (summary row) of DatagridView not sortable .

Is there a way to do it ?

I’ve found a solution :

I’ve overloaded the sortcompare method in this manner :

  private void grid_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
    {
        try
        {
            if (e.RowIndex1 == this.dataGridView1.Rows.Count -1)
                e.Handled = true;
            if (e.RowIndex2 == this.dataGridView1.Rows.Count - 1)
                e.Handled = true;
            return;
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:23:46+00:00Added an answer on May 16, 2026 at 2:23 pm

    You could add a column to the datatable, and set the value for all non-summary records to 0. Set the summary record value to 1, then sort on the “summary” column, then others.

    This might not perform well in memory, so you’d want to do it in the SQL query if possible, depending on the database you use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This I'm assuming is a relatively trivial problem. I have two connected sortable lists,
I want to have something similar to the sortable accordian in JQuery UI, that
I have this list that can be sorted with sortable. How can I move
Have you managed to get Aptana Studio debugging to work? I tried following this,
I have been working with jquery-ui's sortable demo for a while. On looking closely,
I have followed the instructions on http://railscasts.com/episodes/147-sortable-lists for creating a sortable list. The list
On my CMS I have a list of thumbnails (Sortable). The thumbnails work great
I have two HTML lists, and am using JQuery sortable to drag between them.
So I have my own webpage here , which is a sortable thumbnails page.
I have three unordered lists that have been created as Scriptaculous Sortables so that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.