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 1044763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:52:46+00:00 2026-05-16T15:52:46+00:00

Hello all i am using datagrid and it doesnot have auto numbering. so i

  • 0

Hello all i am using datagrid and it doesnot have auto numbering. so i used the following method to number in rowheader but the problem is the numbers are repeating and when they sort a column they are rearranging themselves..Also when i scroll the page, when the row goes out of visibility and when u scroll back again its number is changing..for example on page load you see 1 to 30 in order when u scroll up and down twice, the order can become 1,30,25,4,…etc..theres no specific order..it displays random number in row header..
please suggest a way out for me

In XAML page i called the method in the following way
LoadingRow=”dg_expSummary_LoadingRow”

In the backend the code is as follows

private void dg_expSummary_LoadingRow(object sender, DataGridRowEventArgs e)
{
   e.Row.Header = e.Row.GetIndex() + 1;
}
  • 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-16T15:52:47+00:00Added an answer on May 16, 2026 at 3:52 pm

    I’m doing this in VB.Net. Store the original result set row number in Row(x).Column(0).Tag and then:

    Private Sub gridData_RowPostPaint(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowPostPaintEventArgs) Handles gridData.RowPostPaint
    
        Dim style As DataGridViewCellStyle
        Dim Pen As Pen
        Dim rec As RectangleF
        Dim format As StringFormat
        'Dim n As Integer
    
        'get style to use for row header cells            
        style = gridData.RowHeadersDefaultCellStyle
    
        'get pen (needed to get text brush)            
        Pen = New Pen(style.ForeColor)
    
        'get row rectangle and adjust to width of row header            
        rec = e.RowBounds
        rec.Width = gridData.RowHeadersWidth
    
        'create formating object to center row number            
        format = StringFormat.GenericTypographic
        Format.Alignment = StringAlignment.Center
            Format.LineAlignment = StringAlignment.Center
    
            'draw the row number in row header            
            e.Graphics.DrawString(gridData.Rows.Item(e.RowIndex).Cells(0).Tag.ToString(), style.Font, Pen.Brush, rec, format)
    
        End Sub
    

    My code is adapted from a c# example found here:
    http://www.daniweb.com/forums/thread302079.html

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

Sidebar

Ask A Question

Stats

  • Questions 545k
  • Answers 545k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • added an answer Well, start off by thinking of which bits of data… May 17, 2026 at 9:17 am
  • added an answer For this task it is a good idea to use… May 17, 2026 at 9:15 am
  • added an answer This is exactly how the Skyhook database (built into many… May 17, 2026 at 9:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

hello all i am using this code to show flip animation...... i have a
NOTE: Using .NET 2.0, and VS2005 as IDE Hello all, I'm working on logging
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
Hello all I'm using NSXMLParser to parse some xml data. I'm using this data
hello all i want to retrieve my all the wall post that i have
Hello all you math whizzes out there! I am struggling with a math problem
hello all I have a small dialog which I created dynamically, which has a
Hello all Windows Mobile Experts! I have really drowned in the world of developing
I'm using Zend_Translated to translated all my strings $translator->_('hello') If my locale is in
I'm using the following tutorial http://developer.android.com/resources/tutorials/views/hello-mapview.html in order to create a map view and

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.