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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:36:54+00:00 2026-05-27T16:36:54+00:00

I am a new ASP.NET developer and I am trying to change the value

  • 0

I am a new ASP.NET developer and I am trying to change the value of the first cell in each row in the GridVie by giving it a number starting from 1. It means that I want to add order to the list of things that will be displayed in the GridView.

I am using GridView RowDataBound method but now I don’t know to set the limit of the for loop in it. Could anyone help me with this?

My code-behind:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow) { 
            for(int i=1, i<; i++)
                e.Row.Cells[0].Text = i;
        }
    }
  • 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-27T16:36:56+00:00Added an answer on May 27, 2026 at 4:36 pm

    If your requirement is “change the value of the first cell in each row”, it would be more like:

    private int _rowIndex=0;
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow) { 
                    e.Row.Cells[0].Text = _rowIndex.ToString();
                   _rowIndex++;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm starting a new web project using ASP.NET Webforms + EF4. I'm trying to
I'm new to ASP.NET (I'm a PHP developer) and I'm trying to understand how
I am a New ASP.NET Developer and I am trying to develop a simple
I created a new ASP.NET website using Visual Web Developer 2008 Express edition and
I'm developer moving from C# to Java. Heard about new ASP net feature. <%:
I have a new ASP.NET MVC project (my first), and I had been running
I am a brand new Java developer (I have been working in asp.net) and
I'm new to asp.net, mvc3 and entity framework. I'm trying to develop a mvc3
I'm totally rewriting the question.. I'm new to ASP.Net, and trying to develop a
I am trying to develop an asp.net site with multiple subdomains. I am new

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.