How can i get gridview row count
问题 I am trying to get gvProducts row count. I have tried the below code but it give insufficient result. protected void gvProducts_RowCommand(object sender, GridViewCommandEventArgs e) { string commandName = e.CommandName.ToString().Trim(); GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); if (row.Controls.Count == 1) { //my code } } 回答1: You want total rows in Gridview? Use Count property: gvProducts.Rows.Count Update: To find the rows count of nested gridview, you