About
Pricing
Community
Teams
Start Free Trial
Log in
CipherIS
asked on
3/12/2009
ASP.NET Gridview Unselect Row
How do you "programatically" unselect a row in a gridview?
ASP.NET
C#
Visual Basic.NET
3
1
Last Comment
JohnADavidson
8/22/2022 - Mon
guru_sami
3/12/2009
did you try setting:
GridView1.SelectedIndex property
e.g.
GridView1.SelectedIndex =0; //i.e. select the 1st row
ASKER CERTIFIED SOLUTION
guru_sami
3/12/2009
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
3/12/2009
Maybe this will help:
protected void GridView1_SelectedIndexCha
nging(obje
ct sender, System.Web.UI.WebControls.
GridViewSe
lectEventA
rgs 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
GridView1.SelectedIndex property
e.g.
GridView1.SelectedIndex =0; //i.e. select the 1st row