I'm using C# ASP.NET VS2010.
I have a GridView including a select command button.
This select button points to an action in the code behind C# page activated upon selection.
After performing all required action I would like to clear the selection.
For example: in case the ID="gvInfo" I would like to use something like gvInfo.Deselect();
How do I do that?
ClearSelection() Clears the current selection by unselecting all selected cells.
The User selects the row from the checkbox that he want to delete and on a button click it is deleted from the GridView and from the database too. Open Visual Studio 2010 and create an Empty Website, provide a suitable name (Gridview_demo). In Solution Explorer you get your empty website.
Try this:
Gridview has a property called SelectedIndex. If you want to unselect any rows then set this property to -1.
Thank you for your question Different111222; This question helped me.
gvInfo.SelectedIndex = -1;
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With