asp.net – Grid view – Column – Education Career Blog

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..

,

You will get the no of columns through like this

int NoOfColumns=GridView1.Rows0.Cells.Count;

,

You can find,
How many columns are in gridview with

GridView1.Columns.Count

How many cells are in one row of gridview with

GridView1.Rows...Cells.Count

Best Regards
Myra

Leave a Comment