how do i get data back from a function call to javascript function back to asp .net

i have a listview control and it will fire a javascript call
function HighlightRow(nListID)
                        if (document.getElementById("lv_chk_lvi_" + nListID).checked==true)
                              document.getElementById("lv_row_" + nListID).style.backgroundColor='#ccccff';
                              document.getElementById("lv_row_" + nListID).style.backgroundColor='#ffffff';
when in asp .net i have this
ListItem.CheckBoxDHTML = "onclick=javascript:HighlightRow('#LVI#')"

what i want to do is when i select a button. and call a function thats javascript that will go in and return the values of the checked items on the listview control.

i want to basically end up returning an array of values from a a javascript function that will tell me which IDs of the listview have been selected.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Are these checkboxes in your ListView that the user is clicking?

Will the user eventually click a "submit" or "save" button that will post back to the page?

If so, you can just loop through the rows in the ListView and check if each checkbox was checked when the user clicked the submit button.

For example:

for (int i = 0; i < _myListView.Items.Count; i++)
      if (((CheckBox)_myListView.Items[i].FindControl("_myCheckBoxInListViewRow")).Checked)
            //This checkbox was checked, so do something
godcomputerAuthor Commented:
the checkboxes are being created from a serverside control with a .write to the document page so for some reason i cant use findcontrol? its not finding my items.
Ok...  If you're dynamically creating them by writing them to the page findControl won't work.

You could consider using the asp:CheckBox control instead of writing the checkbox HTML to the page.

If you're not using ASP.Net controls, you can always go through the Form variables manually like this:

foreach (string formID in Request.Form.AllKeys)
      if (Request.Form[formID] == "true")
            //Do something here

You'll have to parse the formID to see if it is the checkbox that you care about or another control.  I'm actually not sure if it will post "true" or "1" or what.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.