Telerik Forums
UI for ASP.NET Core Forum
1 answer
701 views

I have Kendo grid that is configured for batch edit as per the demo. Instead of making 3 separate calls to server for Create, Update and Delete I am handling the SaveChange event of the grid to save all changes ( to maintain transaction)

 

var grid = $("#grid").getKendoGrid();
grid.bind("saveChanges", function (e) {       
    var data = grid.dataSource.data();
 
   // collect updated rows and new rows
    var items = $.grep(data, function (item) {
        return item.dirty || item.id === 0;
    })
 
    // collect deleted rows
    $.each(grid.dataSource._destroyed, function (index, item) {
        item.IsDeleted = true;
        items.push(item);
    })
 
    $.ajax({
        type: "POST",
        data: items,
        url: "save",
        contentType: "application/json; charset=utf-8",
        processData: true,
        cache: false,
    })
    .done(function (response, textStatus, jqXHR) {           
        // do something
    })
    .fail(function (jqXHR, textStatus, errorThrown) {
       // How do i inform datasource or grid about error
 
    })
 
})

 

If there is an error on server while saving changes, the datasource does not know about it. How do i inform datasource ( or trigger error in datasource) that the save operation is failed?

Right now if there is an Error during save, datasource does not know about it and datasource sets updated record's dirty property to false and also clears dataSource._destroyed collection. Beacuase of that if after error user clicks SaveChanges again, the above code will only find records with id  zero

Georgi
Telerik team
 answered on 23 Jan 2018
2 answers
1.0K+ views

Using ASP.NET Core 2.0 Razor Pages

Currently I have a cshtml page that renders a combo/dropdown

 

<select asp-for="DoctorPractice.DoctorId" class="form-control" asp-items="ViewBag.Doctors"></select>

the PageModel for the view contains some code to populate the ViewBag

 var doctors = _context.Doctors;
ViewData["DoctorId"] = new SelectList(doctors, "Id", "FullName");

 

This all works fine - however, now I wish to use the Telerik AutoComplete control because of it's nice features.

I tried this code below without success - i just get js errors.

 @(Html.Kendo().AutoComplete()
                  .Name("doctors")
                  .Filter("startswith")
                  .Placeholder("Select doctor...")
                  .BindTo(ViewBag.Doctors)
             )

Please can I have an example for Razor Pages using the AutoComplete control?

Thanks,

 

 

 

John
Top achievements
Rank 2
 answered on 21 Jan 2018
1 answer
117 views

like this:  .Footer("Today - #=kendo.toString(data, 'd') #")

see also sample here https://demos.telerik.com/aspnet-core/datepicker/template

Stefan
Telerik team
 answered on 17 Jan 2018
1 answer
119 views

MaskedTextbox allows alphabets even after setting maskType a below

@(Html.Kendo().MaskedTextBox().Name("PostalCode").Mask("000000").Value(Model.PostalCode).HtmlAttributes(new { @class = "form-control", @maxLength = "6" }))

Georgi
Telerik team
 answered on 16 Jan 2018
1 answer
152 views

We have a hierarchy grid where we have all the data (parents and children) available. We would like to bind the parents and all children at once, and expand all the rows. Is it possible to do with this server binding? If not, is it possible to load all the hierarchical data in one request on the client via ajax and bind it?

Basically trying not to perform a separate request for each parent row, since it's a relatively small amount of data and we have it all available.

On the ASP.NET MVC grid, I saw a DetailTemplate server property. I didn't see this on the ASP.NET Core grid.

Stefan
Telerik team
 answered on 16 Jan 2018
3 answers
903 views

Hi,

I'm using the server side wrappers to generate a numericTextBox like so

@Html.Kendo().NumericTextBoxFor(m => m.SumInsured).Format("{0:C}").Culture("en-GB").HtmlAttributes(new { @placeholder = "Sum Insured", style = "display: inline-block;" })

 

This generate the following HTML:

<span class="k-widget k-numerictextbox" style=""><span class="k-numeric-wrap k-state-default"><input type="text" class="k-formatted-value k-input" title="" tabindex="0" placeholder="Sum Insured" role="spinbutton" style="display: block;" aria-disabled="false"><input data-val="true" data-val-number="The field SumInsured must be a number." id="SumInsured" name="SumInsured" placeholder="Sum Insured" style="display: none;" type="text" value="" data-role="numerictextbox" role="spinbutton" class="k-input" aria-disabled="false"><span class="k-icon k-i-warning" style="display: none;"></span><span class="k-select"><span unselectable="on" class="k-link k-link-increase" aria-label="Increase value" title="Increase value"><span unselectable="on" class="k-icon k-i-arrow-60-up"></span></span><span unselectable="on" class="k-link k-link-decrease" aria-label="Decrease value" title="Decrease value"><span unselectable="on" class="k-icon k-i-arrow-60-down"></span></span></span></span></span>

 

The problem is that because of the inline style (display: block) applied to the first input element it causes rendering issues in that the box appears to be two lines high. When you then go to change the value the first input is hidden and the second input again has an inline style (display: block) applied which has the same styling issue. In the demos I notice that instead of display: block; display: inline-block is used which does correct the issue. I'm using the same release 2017.3.1026 as the demos. I've also tried by setting an explicit inline-block through the HtmlAttributes function. I also tried with a basic input element and using the API to render the NumericTextBox but it still has the same effect. If it has an relevance this is inside of a kendo window.  Any ideas as to why block instead of inline-block is applied through the JS?

 

Thanks,

Tsvetina
Telerik team
 answered on 15 Jan 2018
2 answers
276 views

Hi,

We have just purchased Telerik UI for ASP.NET Core.

Could I get some help trying to implement a template column that contains and Action Link like the following Tag?

 <a asp-page="./Details" asp-route-id="@item.Id">Details</a>

 

[Using Core Razor Pages, .NET Core 2.0, VS2017]

 

Stefan
Telerik team
 answered on 11 Jan 2018
1 answer
164 views

Hi,

I have a problem with a Grid failing to Render anything.

Would it be acceptable to you for me to zip up my project/db and get some assistance?

The project itself is very small and the db is also tiny.

This is a VS2017, ASP.NET Core Razor Page.

I have one grid working, and on another page the grid does not work at all.

I suspect it maybe either a javascript library not been loaded  - debugging in chrome shows no errors.

Thanks

John
Top achievements
Rank 2
 answered on 11 Jan 2018
2 answers
195 views

For anyone who can help - I'm having an issue with the grid's ability to filter on a field that is of the type decimal. 

Here's what my filter looks like:

restFilter.filters.push({ field: "OrderNumber", operator: "eq", value: searchValue });

Error: Message"The binary operator Equal is not defined for the types 'System.Decimal' and 'System.String'."string

Not sure what to do, any ideas?

Thanks!

Craig

 

 

Craig
Top achievements
Rank 1
 answered on 04 Jan 2018
2 answers
696 views

For anyone who can help - I'm having an issue with gte and lte on dates in the the grid. It works fine if I put a date before and after one for a start/end date but it does not work if the date happens to be equal. For example I have a date 10/08/2014 I know is in my database for DateEntered but the record will only show if I set start date to 10/07/2014 and enddate to 10/09/2014. Neither of them can be 10/08/2014 - won't work that way even tho those filters imply the "or equal to" part.

Here's my script for the filters:

if ((startDate != "") && (Date.parse(startDate))) {
            datesFilter.filters.push({ field: "DateEntered", operator: "gte", value: new Date(startDate) });
        }

        if ((endDate != "") && (Date.parse(endDate))) {
            datesFilter.filters.push({ field: "DateEntered", operator: "lte", value: new Date(endDate) });
        }

        if (datesFilter.filters.length) {
            $filter.push(datesFilter);
        }

Any help would be greatly appreciated!

Thanks,
Craig

Craig
Top achievements
Rank 1
 answered on 03 Jan 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?