Search code examples
asp.netsql-server-2005

Grid view - Column


I am creating an application in asp.net..I used a grid view to show the datas .. By using the autogenerate columns

I bind the datas to the gridview.. Now i want to make a edit button at the end ..By clicking that the user can edit their details ...

But i need to count the number of columns in a row to make a pop up window to edit the details.. How to find out the number of columns in a autogenerated grid..Number of columns varies depend upon the user..So how to find the number of columns..


Solution

  • You will get the no of columns through like this

    int NoOfColumns=GridView1.Rows[0].Cells.Count;