Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GridView - Limit user selection to only one row?

Status
Not open for further replies.

randysmid

Programmer
Dec 12, 2001
801
US
Hi ALL,
I would like to limit my user selection to only one row in the GridView at a time, instead of the default multi-select. Is there any way to set this to only one row selection at a time?

TIA, Randy
 
I don't belive that is true for a web gridview control. Are you talking about the windows gridview?
 
Hi,
I'm talking about the web GridView control.
TIA, Randy
 
Can you explain how you are able to select multiple rows in the web gridview?
 
Hi,
I didn't do anything to enable multiple row selection, but I was given code to check and see which rows were selected. The key lies in the fact that I added a checkbox field to the columns.

foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chk1 = (CheckBox) row.FindControl("chk1");
if (chk1.Checked == true)
{
//code goes here
}
}
 
So this has nothing to do with multiple rows of the grid being selected, which is what I expected. What functionality do you want? Are you looking only to allow the user to be able to select one checkbox for the whole grid?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top