Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVC Bootstrap table next page Delete functionality is not working #162

Open
anandsutar opened this issue Mar 8, 2018 · 0 comments
Open

Comments

@anandsutar
Copy link

anandsutar commented Mar 8, 2018

Hi ,

Currently i am using bootstrap table while display grid on first page edit delete is working fine.but if i navigate to second page nothing happen. Edit working find all pages because i have used below code :
@Html.ActionLink("Edit", "Edit", new { id = item.Id }, new { @Class = "glyphicon glyphicon-pencil btn btn-primary btn-sm" })

Delete

Using delete-prompt class i have called model popup in that yes No button is there after that i am calling deleteConfirmation(Id) method

`$('.delete-confirm').click(function ()
{
deleteConfirmation(Id)

        });

function deleteConfirmation(Id) {

$.ajax({
    /**/
    url: '@Url.Action("DeleteConfirmed", "Users")',
    /**/
    data: { 'Id': Id },
    type: 'POST', //POST if you want to save, GET if you want to fetch data from server
    success: function (data) {
        if (data) {
            //now re-using the boostrap modal popup to show success message.
            //dynamically we will change background colour
            if ($('.modal-header').hasClass('alert-danger')) {
                $('.modal-header').removeClass('alert-danger').addClass('alert-success');
                //hide ok button as it is not necessary
                $('.delete-confirm').css('display', 'none');
                $('.delete-confirm').css('display', 'none');
            }

            $("#checkSucess").show();
            $('.success-message').html('User deleted successfully');
            $("#userNameShow").text('');

            window.location.reload();
        }
    }, error: function (err) {
        if (!$('.modal-header').hasClass('alert-danger')) {
            $('.modal-header').removeClass('alert-success').addClass('alert-danger');
            $('.delete-confirm').css('display', 'none');
        }
        $('.success-message').html(err.statusText);
    }
});

}

`
Delete functionality i have used ajax call. it works on first page but having problem on second page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant