Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Controls / March 2007

Tip: Looking for answers? Try searching our database.

Getting the Value of a Checkbox in the GridView Selected Row

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kirk - 06 Mar 2007 15:00 GMT
I have a GridView that displays several columns, one of which is a
checkbox field. This is populated at runtime from a SqlDataSource and
is not enabled (the user can't change it's value).  I have turned on
the "Enable Selection" option, and I know I can identify what is the
currently selected row.

How can I get the value [True/False] of the checkbox in the selected
row?  For columns that are just text, this works:

System.Diagnostics.Trace.WriteLine(Me.GridView1.SelectedRow.Cells(3).Text)

..but it does not work on a column that is a checkbox (returns nothing
since there is no text in that column).  I have tried to use the Ctype
method to cast the column as a checkbox, but I can't get that to work
either.

I realize that I am missing something stupid, and I would appreciate a
tip or suggestion.
Thank you!
ehubbell - 30 Mar 2007 20:25 GMT
Try something like this - Not pretty but does the job

For Each aCheckBox as Checkox In gv.SelectedRow.Cells(2).Control
 sSuperceded = CStr(aCheckBox.Checked
Nex

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.