WebGrid provides a RowChecker feature which is very helpful to select multiple rows in WebGrid.
In this topic, you will learn the basic thing on how to get checked rows in client side.
To get checked rows in client side
- Add a HTML button in WebForm.
- Create test() function in client side like following:
JavaScript Copy Code function test() { var grd = wgGetGridById("WebGrid1"); var table = grd.GetRootTable(); var checkedRows = table.GetCheckedRows(); var tl = parseFloat(grd.TotalRows); for(var i=0; i<checkedRows.length; i++) { alert(checkedRows[i].cells[3].innerText); } }
- Add OnClick="test()" on your HTML button tag.
- Run the project.