This is a migrated thread and some comments may be shown as answers.

ajax read.Action not calling if Model.customerId has decimal in value

0 Answers 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kamran
Top achievements
Rank 1
Kamran asked on 16 May 2018, 06:59 AM
Hi All,

I am using Telerik UI for ASP.Net MVC Grid tabstrip. I have two tabs. Problem is that if the model.customerId has decimal in value then it does not call read actions like (.Read(read => read.Action("UserVouchers_Read", "Admin", new { customerId = "#=CustomerId#" })))  

so if the customerId is "123456" then the controller action "UserVouchers_Read" is called.

if the customerId is "123456.123" then the controller action "UserVouchers_Read" is not called called.

Below is my code in the view. Please suggest what could be wrong here.

@(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserDataVM>()
             .Name("Users")
             .DataSource(dataSource => dataSource
                   .Ajax()
                   .ServerOperation(false)
                   .Read(read => read.Action("Users_Read", "Admin"))
                   .Events(events => events.Error("onError"))
               )
             .Columns(columns =>
             {
                 columns.Bound(userData => userData.UserDataId).Visible(false);
                 columns.Bound(userData => userData.CustomerId).Title("Client ID");
                 columns.Bound(userData => userData.FirstName);
                 columns.Bound(userData => userData.CreatedDate).Title("Created Date");
             })
             .Pageable(pager => pager.Input(true).PageSizes(true))
             .Sortable()
             .Scrollable()
             .Filterable()
             .ClientDetailTemplateId("template")
             .HtmlAttributes(new { style = "height:700px;" })
)

<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().TabStrip()
            .Name("tabStrip_#=CustomerId#")
            .SelectedIndex(0)
            .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
            .Items(items =>
            {
                items.Add().Text("Voucher Information").Content(@<text>
            @(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserVoucherVM>()
                        .Name("voucher_#=CustomerId#") // template expression, to be evaluated in the master context
                        .Columns(columns =>
                        {
                            columns.Bound(v => v.UserVoucherId).Width(90).Title("Voucher ID").Filterable(false);
                            columns.Bound(v => v.VoucherNo);
                            columns.Bound(v => v.VoucherValue).Visible(false);
                            columns.Bound(v => v.IsVoucherRedeemedStr).Title("Is Voucher Redeemed");
                            columns.Bound(v => v.CreatedDate).Title("Assigned Date");
                        })
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(5)
                            .ServerOperation(false)
                            .Read(read => read.Action("UserVouchers_Read", "Admin", new { customerId = "#=CustomerId#" }))
                        )
                        .Pageable()
                        .Sortable()
                        .ToClientTemplate())
                </text>
                );
                items.Add().Text("Email Activity").Content(@<text>
            @(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserVoucherVM>()
                        .Name("email_#=CustomerId#") // template expression, to be evaluated in the master context
                        .Columns(columns =>
                        {
                            columns.Bound(v => v.UserVoucherId).Width(50).Title("Email ID").Filterable(false);
                            columns.Bound(v => v.CreatedDate).Width(50).Title("Email Sent Date");
                        })
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(5)
                            .ServerOperation(false)
                            .Read(read => read.Action("UserEmails_Read", "Admin", new { customerId = "#=CustomerId#" }))
                        )
                        .Pageable()
                        .Sortable()
                        .ToClientTemplate())
                </text>
                );
            })
            .ToClientTemplate())
</script>

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Kamran
Top achievements
Rank 1
Share this question
or