Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. List view problem

List view problem

Scheduled Pinned Locked Moved C#
helpdatabase
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    annie_bel
    wrote on last edited by
    #1

    hi! I have a listview , which contains some records with checkbox. I have also a linkbutton for select all, delete and so on. my query is, when i click on select all(link button) all checkbox has select. please help me. i use this code, but not work :

    protected void lnkSelect_Click(object sender, EventArgs e)
    {
    foreach (ListViewDataItem lvItem in lstView.Items)
    {
    CheckBox check = (CheckBox)lvItem.FindControl("chksel");
    if (check != null && check.Checked)
    {

               check.Checked = true;
            }
        }       
    }
    

    thanx & regards

    L 1 Reply Last reply
    0
    • A annie_bel

      hi! I have a listview , which contains some records with checkbox. I have also a linkbutton for select all, delete and so on. my query is, when i click on select all(link button) all checkbox has select. please help me. i use this code, but not work :

      protected void lnkSelect_Click(object sender, EventArgs e)
      {
      foreach (ListViewDataItem lvItem in lstView.Items)
      {
      CheckBox check = (CheckBox)lvItem.FindControl("chksel");
      if (check != null && check.Checked)
      {

                 check.Checked = true;
              }
          }       
      }
      

      thanx & regards

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      foreach(ListViewItem listViewItem in listView1.Items)
      {
      listViewItem.Checked = true;
      }

      A J 2 Replies Last reply
      0
      • L Lost User

        foreach(ListViewItem listViewItem in listView1.Items)
        {
        listViewItem.Checked = true;
        }

        A Offline
        A Offline
        annie_bel
        wrote on last edited by
        #3

        hi! I use your code ,listViewItem.checked but (.checked) is not populated.

        1 Reply Last reply
        0
        • L Lost User

          foreach(ListViewItem listViewItem in listView1.Items)
          {
          listViewItem.Checked = true;
          }

          J Offline
          J Offline
          John Smith7700
          wrote on last edited by
          #4

          This article might help you. http://www.mindstick.com/Articles/364dcb8d-f6db-4435-924a-06252f66d1e0/[^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups