This is a migrated thread and some comments may be shown as answers.
Displaying error messages on grid load
1 Answer 63 Views
This is a migrated thread and some comments may be shown as answers.
Boone
Top achievements
Rank 2
Boone asked on 18 May 2012, 09:48 PM
I have a web service that returns me results as this data structure.
public class LoadSearchingReturn
{
    [DataMember]
    public IEnumerable<Results> SearchingResults { get; set; }
    [DataMember]
    public IEnumerable<string> Errors {get;set;}
    [DataMember]
    public int TotalResults { get; set; }
}

TheSearchingResults is what displays in my grid and I use the Total Results inside my schema like:
dataSource: {
    schema: {
        data: "d.SearchingResults",
        total: function (data) {
            return data.d.TotalResults;
        }
    },

So, my question...How do i access that Errors collection and display that to the user?

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 23 May 2012, 03:28 PM
Hello Boone,

I am not sure if I completely understood your scenario. How do you want to display the Errors collection to the user - as a grid column or as a side information?

The dataSource works with a single array of objects and you cannot pass both "d.SearchingResults" and "d.Errors" to it. As a workaround I would suggest to define the data parameter as a function and access the Errors collection before the Json data is processed.

In this demo page you will find an example that uses the aforementioned approach in action.
I hope this helps.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Boone
Top achievements
Rank 2
Answers by
Alexander Valchev
Telerik team
Share this question
or