?
Solved

ListView CheckBox Value

Posted on 2012-04-08
3
Medium Priority
?
376 Views
Last Modified: 2012-06-27
I am trying to get the value of an ID("ToppingID") from a ListView in in VB.NET and add it to a list.

I can do it with the GridView like this:

Dim chk As CheckBox
Dim list As New List(Of String)
        
        For Each rowItem As GridViewRow In GridView1.Rows
            chk = CType(rowItem.Cells(0).FindControl("CheckBox2"), CheckBox)
            If chk.Checked Then
                list.Add(GridView1.DataKeys(rowItem.RowIndex)("ToppingID").ToString()) 
            End If
        Next

Open in new window


How do I do the same thing only with a list view?
What do I use instead of rowItem and RowIndex??
0
Comment
Question by:natethegreat1977
[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
3 Comments
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 2000 total points
ID: 37821153
For Each item As var In listView1.Items
	     Dim chkBox = TryCast(item.FindControl("chkId"), CheckBox)
             If chkBox .Checked Then
              'your code here...  
            End If
Next

Open in new window


Refer here as well:-
http://www.shotdev.com/aspnet/aspnet-vbnet-listview/aspnet-vbnet-listview-findcontrol/
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 38047924
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 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