This question is locked. New answers and comments are not allowed.
I'm trying to set things up with my grid such that every action that every ajax post will include an antiforgery token. My gird is set up like so:
@(Html.Telerik().Grid(Model)
.Name("Folks")
.Sortable(x => x.SortMode(GridSortMode.SingleColumn))
.PrefixUrlParameters(false)
.Footer(true)
.Pageable(x => x.PageSize(25).Total((int)ViewData["total"]))
.DataBinding(dataBinding => dataBinding.Ajax())
.Columns(columns =>
{
columns.Bound(o => o.ParticipantFirstName).Width(120).Title("First Name");
columns.Bound(o => o.ParticipantLastName).Width(120).Title("Last Name");
})
.Selectable()
.ClientEvents(events =>
{
events.OnDataBinding("Test");
})
)
The handler for OnDataBinding (Test) looks like so:
<script type="text/javascript">
function Test(e) {
var valTokenValue = $("input[name=__RequestVerificationToken]").val();
e.data = { __RequestVerificationToken: valTokenValue };
}
</script>
I thought the argument (e) had a property called data which accepted a dictionary of values. However, FireBug keeps complaining saying that data is undefined. Any ideas how I can include the token with every request?
@(Html.Telerik().Grid(Model)
.Name("Folks")
.Sortable(x => x.SortMode(GridSortMode.SingleColumn))
.PrefixUrlParameters(false)
.Footer(true)
.Pageable(x => x.PageSize(25).Total((int)ViewData["total"]))
.DataBinding(dataBinding => dataBinding.Ajax())
.Columns(columns =>
{
columns.Bound(o => o.ParticipantFirstName).Width(120).Title("First Name");
columns.Bound(o => o.ParticipantLastName).Width(120).Title("Last Name");
})
.Selectable()
.ClientEvents(events =>
{
events.OnDataBinding("Test");
})
)
The handler for OnDataBinding (Test) looks like so:
<script type="text/javascript">
function Test(e) {
var valTokenValue = $("input[name=__RequestVerificationToken]").val();
e.data = { __RequestVerificationToken: valTokenValue };
}
</script>
I thought the argument (e) had a property called data which accepted a dictionary of values. However, FireBug keeps complaining saying that data is undefined. Any ideas how I can include the token with every request?