I want to add an additional UserMessage property to the Kendo.Mvc.UI.DataSourceResult that I can access in the datasource change event on the client. The problem is I cant seem to access or see my new property in the javascript datasource Change event.
I extend the existing Kendo.Mvc.UI.DataSourceResult class as below.
public class KendoDataSourceResult : Kendo.Mvc.UI.DataSourceResult { public KendoDataSourceResult(Kendo.Mvc.UI.DataSourceResult dataSourceResult) { this.AggregateResults = dataSourceResult.AggregateResults; this.Data = dataSourceResult.Data; this.Errors = dataSourceResult.Errors; this.Total = dataSourceResult.Total; } //This is my new Property - I want to be able to access this on the public string UserMessage { get; set; } }
In my datasource read method I have the following code which sets my new property.
public ActionResult SearchResults_ReadData([DataSourceRequest]DataSourceRequest request){ IEnumerable<MyData> result = GetMyData(); DataSourceResult x = result.ToDataSourceResult(request); KendoDataSourceResult returnResult = new KendoDataSourceResult(x); //Set my new property here returnResult.UserMessage = "My Test User Message<br/>Second line here<br/>Third line here"; return Json(returnResult, JsonRequestBehavior.AllowGet);}
How do I get the UserMessage property in my javascript Change event?
function datasourceOnChange(e) { if (e && e.sender) { var dataSource = e.sender; //How do I get my UserMessage property ???? var msg = dataSource.UserMessage; //this dosnt work }}
