Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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
  #1 (permalink)  
Old April 16th, 2007, 03:44 AM
Registered User
Join Date: Apr 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default check n uncheck items in checkboxlist in datalist

Any one can help me...
I have a checkbox and a checkboxlist in a datalist. I want the items in the checkboxlist should be checked or unchecked using checkbox control.
Datalist is binded to database table using objectdatasource.

  #2 (permalink)  
Old April 17th, 2007, 01:39 PM
Friend of Wrox
Points: 2,101, Level: 18
Points: 2,101, Level: 18 Points: 2,101, Level: 18 Points: 2,101, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jul 2003
Location: , , .
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts

This is one way to do it. Maybe not the cleanest but it works. There is a way to do it in the itemDatabound
1. Make a function to create the checkboxes.

2. Make a function to check or uncheck the check boxes like the example below which refers to the check box list created in the first function - cblEmpIDView.

    Function getWhatever()
        Dim SQL As String = "SELECT statement to find out which check boxes should be checked.";"
        Dim oDA As New SqlDataAdapter(SQL, _oConn)
        Dim oDS As New DataSet
        For Each i As DataRow In oDS.Tables(0).Rows
        Dim n As ListItem = cblEmpIDView.Items.FindByValue(i("EmpID"))
            If Not n Is Nothing Then
                n.Selected = True
            End If
    End Function

Similar Threads
Thread Thread Starter Forum Replies Last Post
clear items in datalist jtyson ASP.NET 1.0 and 1.1 Basics 7 August 30th, 2007 10:31 AM
radio button check/uncheck lisabb ASP.NET 2.0 Basics 2 May 24th, 2007 02:07 PM
Check all Checkboxlist items on client-side avilren ASP.NET 1.0 and 1.1 Basics 2 July 9th, 2006 10:40 AM
Check all checkboxes in a checkboxlist in repeater jtoth .NET Framework 1.x 0 December 12th, 2005 01:28 AM
clear items in asp.datalist jtyson Classic ASP Basics 0 July 10th, 2003 12:19 PM

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