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

[Solved] Problem with Grid Ajax Rebind

6 Answers 210 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.
Daniel
Top achievements
Rank 1
Daniel asked on 10 Nov 2010, 03:34 PM
Hi.

I recently update to Telerik MVC 2010.3.1110.235. (released today).

My problem is that now the grid's ajax rebind don't work for me. When I delete an item, the grid don't refresh. I must click the "refresh button" to refresh the data.

My grid's are inside a TabStrip.

The Select, Add and Update works fine.

Any idea?

Thanks.

6 Answers, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 1
answered on 11 Nov 2010, 07:53 PM
Can somebody reproduce this error?
The problem still persists. Any help please?
0
Atanas Korchev
Telerik team
answered on 12 Nov 2010, 08:34 AM
Hi Daniel,

 We cannot reproduce this error. Please provide a sample project. Just attach it to this thread.

All the best,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Daniel
Top achievements
Rank 1
answered on 16 Nov 2010, 08:13 PM
Hi Atanas.

My edit is in Inline Mode. I do a little research and I see when the item is deleted in the BD, and execute the rebind

//Rebind the grid
return View(new GridModel
{
  Data = _morbidHistoryRepository.GetPatientById(id)
});

the Json return an "Model Estate", and the refresh id not executed.

Firebug results:

Call: POST http://localhost:4080/MorbidHistory/_DeleteMorbidHistory?rut=17455432
Parameters: rut 17455432
Post: id=58&page=1&size=10&orderBy=&groupBy=&filter=

And the important response:

{"data":[{"Id":59,"Rut":17455432,"Nombre":"dfdfssfds","Tipo":"dfsdsdfsdfs","Fecha":"\/Date(1289876400000)\/","Observacion":null},{"Id":57,"Rut":17455432,"Nombre":"dsf","Tipo":"dsfds","Fecha":"\/Date(1289876400000)\/","Observacion":null}],"total":2,"modelState":{"Nombre":{"errors":["Campo obligatorio"]},"Tipo":{"errors":["Campo obligatorio"]},"Fecha":{"errors":["Campo obligatorio"]}}}

See that the Json return the fields validation, and It's cause that refresh view dont work (i think).

I attach images for view. See image2. Json return 2 item, the grid still show 3. And an object "ModelState" appears.

Thanks.
0
Atanas Korchev
Telerik team
answered on 17 Nov 2010, 07:53 AM
Hello Daniel,

 This is by design. If there are model state errors (validation didn't work) the grid is not rebound. Please make sure you don't have any validation errors.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Daniel
Top achievements
Rank 1
answered on 17 Nov 2010, 02:02 PM
Hi Atanas.

There are no validation errors.

This is the model for the grid:

[KnownType(typeof(PatientAntecedentesMorbidosViewModel))]
public class PatientAntecedentesMorbidosViewModel
{
    [ScaffoldColumn(false)]
    public int Id
    {
        get;
        set;
    }
 
    [ScaffoldColumn(false)]
    public int Rut
    {
        get;
        set;
    }
 
    [Required(ErrorMessage = "Campo obligatorio")]
    [DisplayName("Nombre")]
    [DataType(DataType.Text)]
    public string Nombre
    {
        get;
        set;
    }
 
    [Required(ErrorMessage = "Campo obligatorio")]
    [DisplayName("Tipo")]
    [DataType(DataType.Text)]
    public string Tipo
    {
        get;
        set;
    }
 
    [Required(ErrorMessage = "Campo obligatorio")]
    [DisplayName("Fecha")]
    [DataType(DataType.Date)]
    public DateTime? Fecha
    {
        get;
        set;
    }
 
    [DisplayName("Observación")]
    [DataType(DataType.MultilineText)]
    public string Observacion
    {
        get;
        set;
    }
}

But as I wrote, the problem is only with Delete. The validation only executed on Insert and Edit. It's strange happens when I delete an item. My Telerik build version is 1111, MCV 2.

Thanks.
0
Atanas Korchev
Telerik team
answered on 17 Nov 2010, 02:06 PM
Hello Daniel,

 This

{"Nombre":{"errors":["Campo obligatorio"]},"Tipo":{"errors":["Campo obligatorio"]},"Fecha":{"errors":["Campo obligatorio"]}}}


means that there are validation errors. You can check ModelState.IsValid with the debugger to verify this.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or