Friday 24 August 2012

"Automatic Generate Serial Number Column Value in Grid View when another column value Returned from Database"

First create  a Column Serial Number in Grid View.
Use "RowDataBound" GridView Event.






 protected void  GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {          
            e.Row.Cells[0].Text = Convert.ToString(e.Row.DataItemIndex + 1);

        }
    }

No comments:

Post a Comment