Solved

DataGrid Single row selection - ASP.NET

Posted on 2004-08-30
4
567 Views
Last Modified: 2010-04-07
I have a datagrid in ASP.NET. I need to have only one row selected using a check box column. Created template column for checkbox but not able to have only one check box selected at any time. Need to uncheck if any row is already checked. Thanx.
0
Comment
Question by:amiteshsinha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Expert Comment

by:Howard Bash
ID: 11960415
I hate to skirt the question.  But,  radio buttons are for mutually exclusive list item selections, not checkboxes.  At least that always used to be the case.

I think you need to tie a piece of javascript to the checkbox event.  In your template build the call with a parameter such as the key for the row, and save that id as the "checked_row_id", perhaps as a session variable.  After this, the rendering of the checkbox (checked/unchecked) gets built from this session variable on the postback.

So, one routine might store the currently checked row by some uniqure value (ie. ID),  and then another routine which sets the checked/unchecked for each posted back row, based on comparing the row's ID with the saved ID.

Something like that anyway...
0
 
LVL 4

Accepted Solution

by:
mrdilliard earned 20 total points
ID: 12077384
This is kind of close to what you're looking for. Just don't build in the functionality to select all, and I think that's what you're looking for.

http://www.codeproject.com/aspnet/Multi-select_Dataagrid.asp
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question