This question is locked. New answers and comments are not allowed.
How do I refresh a grid to reflect a new row after uploading a file? I have a file upload control and a grid control. The rows in the grid are made up of data from files in a folder on the server, such as the file names. The data is gathered into a view model and passed to the form. When a new file is uploaded, I would like to update the grid. I can update the model in the controller code, but I can't pass the updated model back to the view, as the only valid ActionResult for Upload's Save server method is Content(string.Empty). Back in the onSuccess() client function in the view, I have tried this:
but nothing happens. I suspect this is because the model hasn't changed on the client.
So how do I "tell" the client grid to add the new row (at the top)? While I'm at it, it would be nice to also clear out the file from the upload display once it is uploaded. That is, I want to remove the shaded box with the green dot showing the file name after upload and instead only show the file in the updated grid.
Incidently, I do not allow multiple file uploads in this application.
Thanks,
Carl
var
grid = $(
"ReportGrid"
).data(
"tGrid"
);
grid.rebind();
but nothing happens. I suspect this is because the model hasn't changed on the client.
So how do I "tell" the client grid to add the new row (at the top)? While I'm at it, it would be nice to also clear out the file from the upload display once it is uploaded. That is, I want to remove the shaded box with the green dot showing the file name after upload and instead only show the file in the updated grid.
Incidently, I do not allow multiple file uploads in this application.
Thanks,
Carl