March 12, 2009

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




'Like' us on our FaceBook page if you find this blog useful. Thanks!


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

2 Responses to "Hide the Selected Row in an ASP.NET GridView"
  1. ASP.NET tips said...
    November 17, 2010 10:52 PM

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

  2. Tanmay said...
    November 18, 2010 12:11 AM

    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.

 

Copyright © 2009-2012 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions