Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8236059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:01:31+00:00 2026-06-07T19:01:31+00:00

I am currently developing a website with CRUD functionality. I am using the below

  • 0

I am currently developing a website with CRUD functionality. I am using the below javascript code to display a message after the Add, Edit, or Delete has been completed successfully.

function addSuccess(data) {
    if (data.Success == true) {
        $('#addDialog').dialog('close');
        $('#commonMessage').html("Process Complete");
        $('#commonMessage').delay(400).slideDown(400).delay(3000).slideUp(400);
    }
    else {
        $("#add-message").html(data.ErrorMessage);
        $("#add-message").show();
    }
}

However, I am rendering results on a partial view containing a webGrid. In this case, a tabular list of products are in this Partial View. After (let’s say) an Edit Process has been completed, I want the edited field to reflect after the Edit Dialog has been closed. My problem is, I don’t know how to refresh a partialview without affecting the whole page.

Can someone please point me to a good way to do this? Thank you very much!


EDIT:

Below is how I add items to my grid. Please note that this entire code is inside my PartialView. Thank you!

@{
    MyStore.Business.Manager.ProductsManager repository = new MyStore.Business.Manager.ProductsManager ();

    List<MyStore.Data.Products> ProductsList = repository.GetAllProducts(ViewData["StoreCode"].ToString());

    var grid = new WebGrid(ProductsList );

    grid.Pager(WebGridPagerModes.All);
            @grid.GetHtml(tableStyle: "webGrid",
                htmlAttributes: new { id = "DataTable" },
                headerStyle: "header",
                alternatingRowStyle: "alt",
                columns: grid.Columns(
                    grid.Column("ProductCode", style: "width: 400px;"),
                    grid.Column("Name", style: "width: 400px"),
                    grid.Column("Price", style: "width: 100px;"),
                    grid.Column("", format: @<text>@Html.ActionLink("Edit", "_Edit", new { RecordID = item.RecordID }, new { @class = "editLink" })</text>, style: "width: 100px"),
                    grid.Column("", format: @<text>@Html.ActionLink("Delete", "_Delete", new { RecordID = item.RecordID }, new { @class = "editLink" })</text>, style: "width: 100px")
                                                 ));                                                      
    }            
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:01:34+00:00Added an answer on June 7, 2026 at 7:01 pm

    Use jquery ajax to reload the content

    if (data.Success == true) {
        $('#addDialog').dialog('close');
        $('#commonMessage').html("Process Complete")
                       .delay(400).slideDown(400).delay(3000).slideUp(400);
    
        $("#yourContainerDiv").load("Url.Action("GetProducts ","Items")")
    
    }
    

    Assuming yourContainerDiv is the Div /table where you have the markup of the Grid and Your GetProducts action method of Items controller returns the markup of the grid.

    and if you are doing the Save/Update in a button click event, Make sure to stop the default form submit behaviour by using peventDefault method

    $("#someButtonId").click(function(e){
      e.preventDefault();
      //Save data or whatever ...
    }); 
    

    EDIT: After seting the updated question.

    Why are you mixing your UI (view) with the code. Keep it seperate.

    Have an action to get the data and pass that to a strongly typed view

    public ActionResult GetProducts()
    {
       var repository = new MyStore.Business.Manager.ProductsManager ();
       var productList = repository.GetAllProducts(ViewData["StoreCode"].ToString());
       return View(productList);    
    }
    

    Now have a view(GetProducts.cshtml) which is strongly typed to Lost of Products class.

    @model MyStore.Data.Products
    @{
      Layout=null;
    }
    <table>
       @foreach(var item in Model)
       {
         <tr>
          <td>@item.ProductCode</td>
          <td>@item.Name</td>
          <td>@item.Price</td>
         </tr>
       }
    </table>
    

    Personally I keep my Entity/Model name as Singular like Customer /Product

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing a website in ASP .NET MVC and I require functionality for
I'm currently developing a website which stores bookmarks in a MySQL database using PHP
I am developing a website using Codeigniter and MongoDB (Alex Bilbie library). Currently there
I'm currently developing a website and part of it involves using Google Maps. I'd
I'm currently developing a CMS for a website I'm making. I'm using MVCScaffolding to
currently i'm developing a website in a class in my university. i'm using PHP
I'm currently developing an ASP.NET website, and I'm using ASP.NET's built-in Login control with
I am currently in the mist of developing a website using PHP and MYSQL.
I'm currently developing a website. Every feature works fine. However, I'm using a lot
I'm currently developing a website. I'm using an img in HTML file with dimensions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.