Hide the Selected Row in an ASP.NET GridView

In order to hide the selected row of a GridView, use this simple technique

C#


    protected void custGV_SelectedIndexChanged(object sender, EventArgs e)


    {


        custGV.Rows[custGV.SelectedIndex].Visible = false;


    }




VB.NET


    Protected Sub custGV_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)


        custGV.Rows(custGV.SelectedIndex).Visible = False


    End Sub




Will you give this article a +1 ? Thanks in advance


About The Author

Suprotim Agarwal
Suprotim Agarwal, Developer Technologies MVP (Microsoft Most Valuable Professional) is the founder and contributor for DevCurry, DotNetCurry and SQLServerCurry. He is the Chief Editor of a Developer Magazine called DNC Magazine. He has also authored two Books - 51 Recipes using jQuery with ASP.NET Controls. and The Absolutely Awesome jQuery CookBook.

Follow him on twitter @suprotimagarwal.

2 comments:

ASP.NET tips said...

i try to think of what case we can utilize this tips. I gave up. Anyone?

Tanmay said...

There can several reasons. We have programmed a Grid which serves as a report tool too. In this tool, users have the capability to look at only the rows that match a condition. They can either manually select and hide rows to view a filtered grid or use a combo to filter it.