Example #1
0
 public ActionResult GridViewPartialAddNew(MVC.Models.SampleModel item)
 {
     //var model = new object[0];
     if (ModelState.IsValid)
     {
         try
         {
             // Insert here a code to insert the new item in your model
             SampleModelList.AddItem(item);
         }
         catch (Exception e)
         {
             ViewData["EditError"] = e.Message;
         }
     }
     else
     {
         ViewData["EditError"] = "Please, correct all errors.";
     }
     return(PartialView("_GridViewPartial", SampleModelList.GetData()));
 }
Example #2
0
 public static void AddItem(SampleModel postedItem)
 {
     SampleModelList.GetData().Add(postedItem);
 }