Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a gridview.

Initially I am selecting rows (of items) in it and displaying those in textboxes and after selecting that particular row, I am hiding that row using gridview.selectedrow.visible=false.

The later, If there are no rows are there in it, I need to get a alert box displaying that there are no items left.

Thanks.
Posted

1 solution

try this,
SQL
if (dataGridView1.RowCount == dataGridView1.SelectedRows.Count)
            {
                // alert message
            }
 
Share this answer
 
Comments
Bhargav.456 21-Nov-12 5:54am    
Sorry, I wrote the above code in gridview selectedindexchanged event.

I am getting the below error.

CS1061: 'System.Web.UI.WebControls.GridView' does not contain a definition for 'RowCount' and no extension method 'RowCount' accepting a first argument of type 'System.Web.UI.WebControls.GridView' could be found (are you missing a using directive or an assembly reference?)
[no name] 21-Nov-12 6:21am    
So what do you want now ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900