GridView - Limit user selection to only one row???

  • Thread starter Thread starter Randy Smith
  • Start date Start date
R

Randy Smith

Hi,
I would like to limit my user selection to only one row in the GridView at a
time. Is there any way to set this?

TIA, Randy
 
Isn't it that by default if you rely on using "Select" command and
GridView's SelectedIndex property. E.g have Buttons etc which have
CommandName="Select" defined, which changes grid's selected row. If you get
the selected row via SelectedIndex/SelectedRow properties, I don't see you'd
have a problem. E.g if you use GridView's own row-selection mechanism
 
Hi,
I was given code to check to see if any rows are selected, but I want to
limit my user to selecting only one row. Here is the code I was given:

foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chk1 = (CheckBox) row.FindControl("chk1");
if (chk1.Checked == true)
{
//code goes here
}
}

So, the above listed code makes it obvious that more than one row can be
selected at any given time.
TIA, Randy
 
Hi,
I was given code to check to see if any rows are selected, but I want to
limit my user to selecting only one row. Here is the code I was given:

foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chk1 = (CheckBox) row.FindControl("chk1");
if (chk1.Checked == true)
{
//code goes here
}
}

So, the above listed code makes it obvious that more than one row can be
selected at any given time.
TIA, Randy








- Show quoted text -

Why use a checkbox, instead of a select button?
 
Back
Top