Avatar of CipherIS
CipherIS
Flag for United States of America asked on

ASP.NET Gridview Unselect Row

How do you "programatically" unselect a row in a gridview?
ASP.NETC#Visual Basic.NET

Avatar of undefined
Last Comment
JohnADavidson

8/22/2022 - Mon
guru_sami

did you try setting:
GridView1.SelectedIndex  property
e.g.
GridView1.SelectedIndex =0; //i.e. select the 1st row
ASKER CERTIFIED SOLUTION
guru_sami

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
JohnADavidson

Maybe this will help:

protected void  GridView1_SelectedIndexChanging(object sender, System.Web.UI.WebControls.GridViewSelectEventArgs e)
{
    if (e.NewSelectedIndex == GridView1.SelectedIndex) {
        e.Cancel = true;
       
        GridView1.SelectedIndex = -1;
    }
   
}
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy