Click here to Skip to main content
15,888,301 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do i Add, Update and Delete in a single view or without redirecting to another page in .net mvc

as much as possible please don't recommend to do ajax or javascript

Thanks

What I have tried:

Making the whole list as partial view and display it to the other view to pretend that it did not redirects but transition is not smooth.
Posted
Updated 20-Nov-16 19:24pm
Comments
You want to post back on save?

1 solution

Hello,

You can use Partial view concept for submit your form data and reload the same partial view on success. Refer below code:

Main Form:
$(document).ready(function () {
fneRegConfiguration();
});

JavaScript
//loading eReg configuration partial view
    function fneRegConfiguration() {
        $.ajax({
            type: "POST",
            url: "../Home/_eRegConfiguration",
            success: function (response) {
                // assign partail view table to div
                $("#dv_eRegConfiguration").html(response);
                
            }
        });
    }


on Partial View:

JavaScript
 function PostGlobalConfiguration() {

        var globalData = new FormData($('#frmGlobalConfiguration')[0]);
        $.ajax({
            type: "POST",
            url: "../Home/SaveGlobalConfiguration",
            processData: false,
            contentType: false,
            data: globalData,
            success: function (response) {
                 fneRegConfiguration();
           }
}


Using this concept you can Add, Update and Delete in a single view or without redirecting to another page and without refresh the main page in .net mvc

If you have any more query, ask me freely.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900