Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
500
how can i delete all rows in ultrawebgrid on client-side?
posted
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
	{
// 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);
}
}
Parents
No Data
Reply
  • 7694
    Verified Answer
    posted

     

    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.

     

Children