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

[Solved] What should be returned?

1 Answer 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jared
Top achievements
Rank 1
Jared asked on 21 Feb 2012, 01:44 AM
[GridAction(EnableCustomBinding = true)]
public ActionResult DeleteFile(GridState state, int id)
{
    //Removed code for simplicity
 
    if (reply != null && reply.Success)
    {
        return Json("", "text/plain");
    }
    return Json("");
}

This action gets fired when deleting a row from the grid, everything is ajax databound. The Grid tries to rebind but when debugging, telerik.common.min.js complains: "Unable to get value of the property 'length': object is null or undefined".

I've been trying to figure out where this is coming from, the Grid itself isn't throwing any errors so I'm a bit lost at what I'm doing wrong? 
My only way around this so far is in the grid's "onComplete" event... I check if the name is "delete" if so rebind the Grid manually. I still get the script error, but it "works". Hopefully I'm just missing something simple?

1 Answer, 1 is accepted

Sort by
0
Jared
Top achievements
Rank 1
answered on 21 Feb 2012, 11:38 PM
I just did it a different way, because it seems as I am required to return back a list of objects. I wouldn't think I HAVE to return something on a delete, since that doesn't always makes sense.
Tags
Grid
Asked by
Jared
Top achievements
Rank 1
Answers by
Jared
Top achievements
Rank 1
Share this question
or