How to add a numeric order to the GridView using RowDataBound?
<p>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.</p>

<p>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?</p>

<p>My code-behind:</p>

<pre><code>protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow) { 
            for(int i=1, i&lt;; i++)
                e.Row.Cells[0].Text = i;
        }
    }
</code></pre>
