Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 11th, 2007, 11:31 PM
Registered User
 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Gridview with checkboxes

I've created a gridview bound it to a dataset and added two checkbox columns. What I would like to have happen is when a user checks the box, then clicks the submit button, the row with the box checked will be updated in the database. The problem I'm facing is when the user clicks on a checkbox and pushes the submit button the checkbox.checked method is always False.

Protected Sub btnSubmit_Clicked(ByVal sender As Object, ByVal e As EventArgs) Handles btnSubmit.Clicked

     For Each row As GridViewRow in grdResults.Rows
          Dim chkbox1 As CheckBox = CType(row.FindControl("ckb1"), CheckBox)
          If chkbox1.Checked = True

               check1 = True
               EdIDs += CType(row.FindControl("edid1"), Label).Text.ToString() + ","
          End If
          Dim chkbox2 As CheckBox = CType(row.FindControl("ckb2"), CheckBox)
          If chkbox2 .Checked = True

               check2 = True
               EdIDs += CType(row.FindControl("edid2"), Label).Text.ToString() + ","
          End If





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
Checkboxes in Gridview ramuis78 ASP.NET 2.0 Basics 0 October 11th, 2007 09:55 AM
delete using checkboxes in gridview aspvbnet ASP.NET 2.0 Basics 1 November 22nd, 2006 08:28 PM
Update all checkboxes in GridView using one Submit dba123 ASP.NET 2.0 Basics 0 April 23rd, 2006 07:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.