This question is locked. New answers and comments are not allowed.
I have the following block of code
1. A datetime control
2. A grid control which does data binding through Ajax. One of the parameters to the binding method on the controller is the date selected on the datetime control. How do I pass this to the action method of the controller. I have given the sample code which I am trying to use down below.
@Html.Telerik().DatePicker().Name("marketDate").Format("dd-MM-yyyy").Value(DateTime.Now.Date)
@(Html.Telerik().Grid<StPo.EntityInterfaces.IFetchedStockInfo>().Name("GrdName")
.Columns(columns =>
{
columns.Bound(stk => stk.Code).Width(100);
columns.Bound(stk => stk.Title).Width(200);
})
.DataBinding(dataBinding => dataBinding.Ajax().Select("FetchNextMarketValueSet", "Home", new { marketDate = DateTime.Now.Date }))
.EnableCustomBinding(true)
.Pageable(pagerSettings =>
{
pagerSettings.Total(int.Parse(ViewData["Total"].ToString()));
pagerSettings.PageSize(10);
})
.ClientEvents(events => events.OnDataBinding("Grid_onDataBinding"))
)
<script type="text/javascript">
function Grid_onDataBinding(e) {
alert("binding");
var grid = $("#GrdName").data('tGrid');
var marketValueDate = $("#marketDate").val();
alert(marketValueDate);
}
</script>
1. A datetime control
2. A grid control which does data binding through Ajax. One of the parameters to the binding method on the controller is the date selected on the datetime control. How do I pass this to the action method of the controller. I have given the sample code which I am trying to use down below.
@Html.Telerik().DatePicker().Name("marketDate").Format("dd-MM-yyyy").Value(DateTime.Now.Date)
@(Html.Telerik().Grid<StPo.EntityInterfaces.IFetchedStockInfo>().Name("GrdName")
.Columns(columns =>
{
columns.Bound(stk => stk.Code).Width(100);
columns.Bound(stk => stk.Title).Width(200);
})
.DataBinding(dataBinding => dataBinding.Ajax().Select("FetchNextMarketValueSet", "Home", new { marketDate = DateTime.Now.Date }))
.EnableCustomBinding(true)
.Pageable(pagerSettings =>
{
pagerSettings.Total(int.Parse(ViewData["Total"].ToString()));
pagerSettings.PageSize(10);
})
.ClientEvents(events => events.OnDataBinding("Grid_onDataBinding"))
)
<script type="text/javascript">
function Grid_onDataBinding(e) {
alert("binding");
var grid = $("#GrdName").data('tGrid');
var marketValueDate = $("#marketDate").val();
alert(marketValueDate);
}
</script>