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 8325891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:35:14+00:00 2026-06-09T00:35:14+00:00

I am using jqgrid Modal form to Add and Edit rows of the table.

  • 0

I am using jqgrid Modal form to Add and Edit rows of the table. I am using Entity framework and Database First approach to create models from existing database. When I Add or Edit the rows, rows are added or edited correctly and being saved appropriately in the database and when I retrieve the added or edited rows and view in jqGrid, they are displayed correctly. But, the only issue is when I Add or Edit, it throws error Status: ‘Internal Server Error’. Error Code: 500 in the modal form.

Anyone has any idea of why is this happening? Since, the add or edit is happening properly, is there a way that I can ignore this error message and make it not displayed at all?

Any help is greatly appreciated!

EDIT:

public ActionResult Create(string oper, string id, Employee employee)
{
try
{
 if (oper == "add")
 {
   if (ModelState.IsValid)
   {
    db.Employees.Add(employee);
    db.SaveChanges();
    return RedirectToAction("Index");   
   }
 }
 if (oper == "edit")
 {
  if (ModelState.IsValid)
  {
    db.Entry(employee).State = EntityState.Modified;
    db.SaveChanges();
    return RedirectToAction("Index");
  }
 }
  if (oper == "del") 
  {
    Employee employees = db.Employees.Find(Int32.Parse(id));
    db.Employees.Remove(employees);
    db.SaveChanges();
    return RedirectToAction("Index");
  }
}
catch (InvalidOperationException ex)
{
}
catch (Exception e)
{
}
}
  • 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-09T00:35:16+00:00Added an answer on June 9, 2026 at 12:35 am

    Thanks to everyone for all your suggestions. I figured out what I was doing wrong. Actually, the issue is not with incorrect data format or the code not being hit, the problem was after I saved changes to my database, that’s why it was not caught in the exception block.

    After saving the changes to the database as [db.SaveChanges()], I am redirecting to the Index Action. That’s where the issue was. I was redirecting to the wrong Index action. The code inside this Index action tried to return some value that is null and hence ArgumentNullException was thrown and that displayed YSOD.

    Note: I was able to spot the ArgumentNullException with Event Viewer. Type Event Viewer in Run and the Goto Windows Logs – Application. You will be able to see all the Warnings for your application. Open the warning, Goto General tab and you will be able to see what kind of exception is thrown. Hope this helps someone in need.

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

Sidebar

Related Questions

I am using Database First approach to create models from existing database. I have
I am using jQgrid for doing a table and I want to add an
i m using jqgrid with mvc 3, I want to add Edit and Delete
This is the first time I'm using jqgrid. I have confused in how to
I'm using jqgrid for which I create column definitions on server as dynamic objects
I'm using jqGrid plugin and I want to add onKeyPress event to each field
Hi I'm using jqGrid and I'm wondering, how do I add jQueryUI's datepicker to
I'm using jqGrid and I have a problem getting Dynamic Linq to work. I
I am using jqGrid v3.8.1 and having trouble passing extra parameters with the predefined
I am using JQGrid I have it on 2 domains (same code)... On domain

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.