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

  • SEARCH
  • Home
  • 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 6843993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:19:18+00:00 2026-05-27T00:19:18+00:00

I am trying edit the header cell value when using a grid view in

  • 0

I am trying edit the header cell value when using a grid view in virtual mode, but I can’t get it working.

In my CellValueNeeded event I have the following code:

grvResults.Rows[e.RowIndex].HeaderCell.Value = record.RecordNumber;

Unfortunately, my header cells are still displaying blank.

How can I get the row header values to display? The end result is I need my rows to show what row number they are, to better keep track of data.


Update: The full event code is below:

    private void grvResults_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
    {
        const int BATCH_REQUEST_SIZE = 50;
        int row = e.RowIndex + 1;
        LogRecord record = null;

        // Check if this record for this row is cached
        if (!_recordCache.ContainsKey(row))
        {
            // Retrieve the requested record + a batch more to speed up operations and lessen queries
            int page = (row / BATCH_REQUEST_SIZE) + 1;

            var records = _currentStore.GetFilteredRecords(_filters, _currentSessionId, BATCH_REQUEST_SIZE, page);
            if (records.Count > 0)
            {
                // Add all the records to the cache
                for (int x = 0; x < records.Count; x++)
                    if (!_recordCache.ContainsKey(row + x))
                        _recordCache.Add(row + x, records[x]);
            }
        }

        // Get the record from the cache
        record = _recordCache[row];

        if (record != null)
        {
            // Set the header cell to the record number
            grvResults.Rows[e.RowIndex].HeaderCell.Value = record.RecordNumber;

            // Match the cell to the field
            string cellFieldName = grvResults.Columns[e.ColumnIndex].Name;
            if (record.Fields.Any(x => x.FieldName.Equals(cellFieldName, StringComparison.CurrentCultureIgnoreCase)))
                e.Value = record.Fields.Where(x => x.FieldName.Equals(cellFieldName, StringComparison.CurrentCultureIgnoreCase)).Single().StringValue;
        }
    }
  • 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-27T00:19:18+00:00Added an answer on May 27, 2026 at 12:19 am

    In the brief experiments I’ve done the HeaderCell.Value always shows in the row header, regardless of where it was set or whether the grid was in virtual mode.

    One possibility is that the row header is too narrow to see the value.

    Another is that RecordNumber is not a string – the Value displayed in the row header must be a string.

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

Sidebar

Related Questions

I'm trying to get edit-and-continue working with Visual Studio 2008 with an ASP.Net MVC
I'm trying to enter edit mode on a specific cell like this: void MainWindow::on_addButton_released()
I'm trying to edit the output joomla main_menu module so I can make a
I am trying to get the Edit with Vim context menu to open files
I'm trying to edit a .docx header through Word Automation. If the Content Controls
I'm trying to edit my sidebar.php file in my current them WP is using
I'm trying to do : document.getElementById(header-text).innerHTML = something interesting; It's working fine with every
im trying to edit a field using code instead of the wizard. im not
Trying to get this form to validate email using the function the professor said
I am trying to figure out how to read header links using C#.NET. I

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.