Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 September 6th, 2004, 03:34 AM
Authorized User
 
Join Date: Jul 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using Checkboxes in datagrid

Hi,
   i am facing a problem with the checkboxes displayed in the datagrid.when the data are displayed, one of the columns has the checkboxes.Now i want that when i select some checkboxes, the rows corresponding to those selected, should be updated or deleted. I tried this using datagriditem and using a loop to search the entire data. But how can i get the value of the checkboxes to see whether it is checked or not ? Please give some idea.

 
Old September 9th, 2004, 12:42 AM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to salvation_devx
Default

You can use FindControl Method like this
(chkSelect is name of CheckBox Control in Datagrid)

Dim dtgItem As DataGridItem
Dim chkControl As CheckBox

For Each dtgItem In Datagrid1.Items
    chkControl = dtgItem.FindControl("chkSelect")
    If chkControl.Checked = True Then
        ' do something ...
    Else
        ' do something ...
    End If
Next

 
Old September 21st, 2004, 05:14 AM
Authorized User
 
Join Date: Jul 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, I did as you said.I took one integer variable " i " and set its initial value to 1. Then in the If part I increment it by 1 and doing nothing in the else part.At last after it comes out from the loop i printed it in a label.But the problem is everytime the value of the integer is coming out as 1, the initial value.Again when I tried to increment " i " in the else part, it is incrementing but taking all the values of the checkboxes, if there are 4 checkboxes, value becomes 5, if there are 7, value becomes 8 , like this. What should i do now ? Please givew some idea.






Similar Threads
Thread Thread Starter Forum Replies Last Post
selection of all checkboxes inside the datagrid yes_no ASP.NET 1.0 and 1.1 Professional 4 April 15th, 2008 07:31 AM
Select all checkboxes in a datagrid kawal.singh C# 2 May 7th, 2007 02:09 PM
C# Datagrid Help foreach statement checkboxes mbge9pjb C# 4 December 20th, 2005 09:43 AM





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