Wednesday, 3 July 2013

Add and Remove Dynamic Control using Jquery

$('#<%=btnRemove.ClientID %>').live('click', function () {

                var rowCount = $('#tblAccount tr').length;
                if (rowCount < 2) {
                    alert('There is No Data For Delete !');
                    return false;
                }
                else {
                    var $this = $(this),
                $parentTR = $this.closest('tr');
                    $parentTR.remove();
                }
            });
            $('#<%=btnAddAnother.ClientID %>').live('click', function () {


                var $this = $(this),
                $parentTR = $this.closest('tr');
                $parentTR.clone().insertAfter($parentTR);

                return false;
            });