Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I have a gridview in which i show details of products complaints we receive from customer.
Whenever we take action on complaints we sometimes replace few parts of products, for this purpose i have a checkboxlist in my Gridview column no. 7 for each row. This CheckBoxList contains replaceable parts and one can select more than one part for each complaint (each row).

I want to write a javascript which can loop through each gridview row and as soon as i select the chekcboxlist items in 7th column it shows them on a label in column no 8 for each gridview row.
So basically i need to write a javascript which has a loop for each gridview row and then a loop to read checkboxlist selected items for each row.

Please help i am not able to write that javascript, also please tell me how and where should i call that javascript.
Thanks in advance.
Posted

1 solution

First up. GridView is an asp control. It has some properties like ID and DataSource etc but these are just tools. In the end (as with all asp controls) it renders to html.

The control render process literally writes html line by line to in the response.

Javascript doesn't care what a DataGrid is because javascript runs on the client browser after the page has been rendered. It will never see a DataGrid.

What it will see is the html that has been rendered.

DataGrid (usually) renders to a table.

Open up the page in a browser and view the page source html. Find your control as it has been rendered. The id will be something like ct100$MyPanel$MyGridView.

Your javascript will have to parse this table.

I hope that gets you started.

Please accept this solution and post a new question if you need help parsing the html table in javascript

Good luck ^_^
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900