function DeleteRow() { igtbl_getGridById("UltraWebGrid1").AllowDelete=1; var row=igtbl_getRowById("UltraWebGrid1r_0"); igtbl_deleteRow("UltraWebGrid1","UltraWebGrid1r_0"); var cnt=0; // Create a loop, if the row has a next sibling then we need to delete it while(row.NextSibling!=null) //but row.nextsibling always undefined
function
var
// Create a loop, if the row has a next sibling then we need to delete it
while
null
{ // Increment the counter for the next rowID cnt+=1; // Get the row current row using the name of the grid and the row // number from our counter so we can check it for a sibling row=igtbl_getRowById("UltraWebGrid1r_"+cnt) // Finally delete that row, igtbl_deleteRow("UltraWebGrid1","UltraWebGrid1r_"+cnt); }}
// Increment the counter for the next rowID
// Get the row current row using the name of the grid and the row // number from our counter so we can check it for a sibling
// Finally delete that row,
Hello,
You can try with code below:
<input id="Button1" type="button" value="button" onclick="return DeleteRow()" />
<script type="text/javascript">
function DeleteRow() {
var grid = igtbl_getGridById("<%= UltraWebGrid1.ClientID %>");
var rowsLenght = grid.Rows.length;
for (var i = 0; i < rowsLenght; i++){
igtbl_deleteRow("UltraWebGrid1","UltraWebGrid1_r_"+i);
}
</script>
Hope this helps.
Hello, I know this is an old post but I have an application that already uses UltraWebGrid.
I need to delete all rows clientside but it doesn't work!
Is not giving any error but rows are not deleted.
How is possible to do that? Thanks
The answer is:
var oGrid; var oAddedRow; //Get a reference for the grid on the client oGrid = igtbl_getGridById('grdLogistic'); //Clear rows igtbl_getGridById("grdLogistic").AllowDelete = 1;var idRow;
for (var i = oGrid.Rows.length-1; i >= 0; i--) { idRow = oGrid.Rows.rows[i].Id; //igtbl_deleteRow("grdLogistic", "grdLogistic_r_" + i); igtbl_deleteRow("grdLogistic", idRow);
Please test code before to post it.... the previos one is absolutely wrong.