[AcceptVerbs("Get")]
public ActionResult GetAllSec1([DataSourceRequest]DataSourceRequest request)
{
try
{
HBLTradeInSecurityViewModel TradeInSecurity = new HBLTradeInSecurityViewModel();
ServiceRepository serviceObj = new ServiceRepository();
HttpResponseMessage response = serviceObj.GetResponse("/api/HblTradeInSecurities/GetAllHBLTradeINSec?brcode=" + "01");
response.EnsureSuccessStatusCode();
List<Models.HBLTradeInSecurityViewModel> data = response.Content.ReadAsAsync<List<Models.HBLTradeInSecurityViewModel>>().Result;
DataSourceResult result1 = data.ToDataSourceResult(request);
//ViewBag.Title = "All Blotter";
// return View(TradeInSec);
// return Json(data, JsonRequestBehavior.AllowGet);
// return Json(result1);
return Json(result1, JsonRequestBehavior.AllowGet);
}
catch (Exception)
{
throw;
}
}
===============================================================================================
<div class="row clearfix">
@(Html.Kendo().Grid<HBLTradeInKendoUIBootstrap.Models.HBLTradeInSecurityViewModel>()
.Name("gridSec")
.AutoBind(false)
.HtmlAttributes(new { @class = "ra-section" })
.Columns(columns =>
{
columns.Bound(p => p.ID).Title("ID").Width(5); ;
columns.Bound(p => p.Security).Title("Security ID").Width(15); //.Locked(true).Lockable(false); ;
//columns.Bound(p => p.EnableValue).Title("ON/OFF").Width(8).ClientTemplate("<input type='checkbox' \\#= Active ? checked='checked' :'' \\# />"); ;
columns.Select().Width(10);
columns.Bound(p => p.S_MAT_DATE).Title("Mat. Date").Width(11);
columns.Bound(p => p.DaystoMaturity).Title("DTM").Width(8);
columns.Bound(p => p.LongValue).Title("Long").Width(8);//.Filterable(ftb => ftb.Multi(true)); ;
columns.Bound(p => p.SizeMM1).Title("Size MM").Width(12);
columns.Bound(p => p.Bid).Title("Bid").Width(8);
columns.Bound(p => p.Ask).Title("Ask").Width(8);
columns.Bound(p => p.SizeMM2).Title("Size MM").Width(12);
columns.Bound(p => p.ShortValue).Title("Short").Width(8);// .ClientTemplate("<input type='checkbox' disabled='disabled' #=MadeChoicePresets2IsSelected ? checked='checked' : '' # />");
columns.Bound(p => p.MinAmt).Title("Min Amt.").Width(6);
columns.Bound(p => p.LastValue).Title("Last").Width(6);
columns.Command(command => { command.Edit(); }).Width(15);
})
//.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("AdminCustomEdit"))
.Pageable()
.Sortable()
.Scrollable()
.Events(ev => ev.Change("onChange"))
.PersistSelection()
.HtmlAttributes(new { style = "height:500px;" })
.DataSource(dataSource => dataSource
.Ajax() //Specify that Ajax binding is used.
.Model(model =>{model.Id(p => p.ID);})
//.Read(read => read.Action("GetAllSec1", "HBLTradeInSecurity")) // Set the action
.Read(read => read.Url("/HBLTradeInSecurity/GetAllSec1").Type(HttpVerbs.Get))
.Update(update => update.Action("Update", "HBLTradeInSecurity"))
))
<script type="text/javascript">
function error_handler(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}
function onChange(arg) {
kendoConsole.log("The selected product ids are: [" + this.selectedKeyNames().join(", ") + "]");
}
</script>
</div>
===================================================================================================
same problem in one view it working, i just copy and past in another view it only displaying raw data.