Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8475267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:50:51+00:00 2026-06-10T17:50:51+00:00

Each row of a ListView has a checkbox. When the user clicks Delete Selected

  • 0

Each row of a ListView has a checkbox. When the user clicks Delete Selected row(s) LinkButton, only rows that have the checkbox checked are deleted. I’m thinking about getting all the checkboxes in an array first then loop through to see which one was checked.

This is what I have tried.

    function CheckBoxBeforeDeleteing() {
        var lv = document.getElementById("MainContent_ListView1");
        //var inputs = lv.childNodes;
        //alert(inputs.Length);
        alert("Test");
    }

If I don’t comment out the 2 lines, the function is not even executed. It looks like I need to go deeper. Does Javascript has something function like the C#’s FindControlRecursive?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:50:53+00:00Added an answer on June 10, 2026 at 5:50 pm

    You can loop through the elements in the forms using loop in javascript as give below. Suppose you have form1 in your page with runat="server" then get the form and iterate through its controls using loop and find the checkboxes within form.

    var elem = document.getElementById('<%= form1.ClientID %>').elements;
    
    function CheckBoxBeforeDeleteing() 
    {
        for(var i = 0; i < elem.length; i++)
        {
              if(elem[i].id.indexOf('chkBoxId') != -1)
              {
                   if(elem[i].checked)
                   {
                         //Your code here
                   }
              }   
        }
    }
    

    Accessing form with index

    function CheckBoxBeforeDeleteing() 
    {
        for(i=0;i<document.forms[0].length;i++)
        {
              e=document.forms[0].elements[i];
              if (e.id.indexOf("chkBoxId") != -1 )
              {
               if(e.checked)
                   {    
                  //Your code goes here     
                   }        
              } 
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a listview with custom rows and that extends SimpleAdapter. Each row consist
I have a ListView that each row has a title on the left side
I have a ListView that uses SimpleAdapter, each row has 2 TextViews, and I
I have a ListView that creates a table. Each row in the table has
I have a ListView whose rows are formatted by me. Each row has a
I have a C#, WPF ListView that has checkbox and a string in each
I am writing an app that has a ListView of text. In each row
I have a ListView and each row has an ImageView. These Images are downloaded
I have a listView, where each row has a button in the row layout.
Currently I have a list view within it each row has a checkbox attached.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.