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

  • SEARCH
  • Home
  • 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 6845691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:31:54+00:00 2026-05-27T00:31:54+00:00

public ActionResult DeleteCategory(int id) { CategoryManager manager = new CategoryManager(); manager.DeleteCategory(id); TempData[IsDeleted] = true;

  • 0
public ActionResult DeleteCategory(int id)
{
     CategoryManager manager = new CategoryManager();
     manager.DeleteCategory(id);
     TempData["IsDeleted"] = true;
     return RedirectToAction("CategoriesList");
}

 public ActionResult CategoriesList()
 {
     List<CategoryModel> model = new CategoryManager().GetAll();
     return View(model);
 }

 public void DeleteCategory(int categoryId)
 {
     using (AsoEntities context = new AsoEntities())
     {
         var categoryToDelete = (from c in context.Categories 
            where c.Id == categoryId
            select c).SingleOrDefault();
         if (categoryToDelete == null)
            return;

         context.Categories.DeleteObject(categoryToDelete);
         context.SaveChanges();
     }
 }

Javascript:

$(document).ready(function () {    
    // Dialog
    $('.delete-link').click(function () {
        deleteLinkObj = $(this); //for future use
        $('#delete-dialog').dialog('open');
        return false; // prevents the default behaviour
    });

    $('#delete-dialog').dialog({
        autoOpen: false, width: 400, resizable: false, modal: true, //Dialog options
        buttons: {
            "Da": function () {
                $.post(deleteLinkObj[0].href, function (data) { //Post to action
                    if (data == '<%= Boolean.TrueString %>') {
                        deleteLinkObj.closest("tr").hide('fast'); //Hide Row
                        //(optional) Display Confirmation
                    }
                    else {
                        //(optional) Display Error
                    }
                });
                $(this).dialog("close");
            },
            "Ne": function () {
                $(this).dialog("close");
            }
        }
    });
});

When I delete an article I am taken back to CategoriesList; but the page is not reloaded if I am already on CategoriesList. How can I make it so that the page will be re-loaded and the data will be refreshed?

Edit:

If I remove the Javascript then it starts working. Where is the problem in the Javscript?

  • 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-05-27T00:31:55+00:00Added an answer on May 27, 2026 at 12:31 am

    You are using jquery to delete the item asynchronously which will mean that the page is not reloaded.

    Your code has this line: if (data == ‘<%= Boolean.TrueString %>’) { but in the server side method is not returning a bool so the above line will never equal true and so deleteLinkObj.closest(“tr”).hide(‘fast’); //Hide Row is never called.

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

Sidebar

Related Questions

public ActionResult DoSomething() { return View(Index, new IndexModel { Foo = new List<string>() {
public ActionResult About() { List listStores = new List(); listStores = this.GetResults(param); return Json(listStores,
i have 2 actions public ActionResult FilesAdd(int id) { FillParentMenuDDL(id); return View(); } [HttpPost]
I have the following code: public ActionResult SomeAction() { return new JsonpResult { Data
public ActionResult Index() { testEntities6 devicesEntities = new testEntities6(); List<DevicesModel> devicesModel = new List<DevicesModel>();
Here is my code: public ActionResult MainMenu(int id) { using (WebDataContext context = new
Controller.cs is: public ActionResult ViewRequest(int id) { Job job = Jobs.GetJob(id); return View(job); }
public ActionResult MyFile(string MetaValue,int OrganizationId=0) { OrganizationUsersDataContext OrgMeta = new OrganizationUsersDataContext(); JobsRepository JobsRespository =
public ActionResult GeneratePdf(int id) { var labelRepository = new LabelRepository(); var label = labelRepository.GetLabel(id);
So I have this: public ActionResult ViewForum(int ForumID) { _frmSrv = new ForumService(); _roleSrv

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.