This is a migrated thread and some comments may be shown as answers.

Grid in Partial View with Editor Template

2 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 20 May 2014, 03:03 AM
I've got a grid that is in a partial view (loaded into the content of a tabstrip).  The grid has an update command which calls a post method on my controller.  This is all working properly but the popup window for the editor template does not close after it posts.  I know it has to do with what I am returning from my post method but I'm not sure what I should return to allow the window to close.  Normally I pass back my view model to the partial view and that is what I am doing now and the window stays open. I've also tried just return PartialView() but with the same result.

Here is my controller post method:

[HttpPost]
public ActionResult UpdateAttachment(int proposalID, AttachmentsViewModel vm)
{
    User user = new User();
    int user_id = user.GetUserIDByBNLAccount(User.Identity.Name);
 
    if (CheckProposalReadAccess(user_id, proposalID))
    {
        using (var context = new PASSEntities())
        {
            var model = context.Proposal_Attachments.Find(vm.ID);
             
            model.Inappropriate_Content = vm.Inappropriate_Content;
            context.Entry(model).State = System.Data.EntityState.Modified;
            context.SaveChanges();
 
            return PartialView(vm);
        }
    }
    else
    {
        return PartialView();
    }
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 21 May 2014, 06:16 PM
Hello Stephen,

Are you using Ajax editing for the Grid? If yes, then you should return a JsonResult from the action method as demonstrated in this documentation topic.

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Stephen
Top achievements
Rank 1
answered on 22 May 2014, 02:28 AM
Yes I realized that shortly after posting.  Thanks!
Tags
Grid
Asked by
Stephen
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Stephen
Top achievements
Rank 1
Share this question
or