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

I have seen a number of Threads on this but none that fully answers what I am trying to achieve. I am after the following :

ToolBar(toolbar =>
                                    {
                                        toolbar.Create().Text("New Order");
                                        toolbar.Custom()
                                                . call an action method i.e "<a class='k-button' href='" + Url.Action("Submit", "myController")+"'"+">Submit</a>")
                                                .Text("Submit").IconClass("k-icon k-i-cancel");

                                    })

 

The answer on a previous tread :   toolbar.ClientTemplate("<a class='k-button' href='" + Url.Action("Submit", "myController")+"'"+">Submit</a>");

Does not tell me how I can add the toolbar.Create().Text("New Order"); to the same template.

I also want to pass to the submit action the current Datasource request information i.e filtering etc so that I can refresh the grid on finish.

 

 

 

 

Nikolay
Telerik team
 answered on 23 Mar 2020
20 answers
1.4K+ views

I am attempting to set up a Grid in ASP.Net Core 2.1 using Razor Pages.  This grid could potentially load thousands of records so I want to only load those that I need and use ajax server side sorting/grouping etc.  I have searched around and had trouble getting this to work as I like, which is completely inside the PageModel.  Using Razor Pages it is very easy to load all the data locally, but am I correct that you can not load the data remotely Ajax style without setting it up in a separate service layer?  I can set up my own remote endpoints if needed, but am confused as to why the Grid can not treat the page handlers of the PageModel as usable endpoints as long as they return the appropriate JSON.  If it can do this, could I be pointed to a simple sample?   Thanks.

Georgi
Telerik team
 answered on 23 Mar 2020
4 answers
222 views

Hi,

I followed your tutorial on "Copying Client Side Resources" (https://docs.telerik.com/aspnet-core/getting-started/getting-started-copy-client-resources).  I'm using the last option, using NPM and webpack.  I'm also including vanilla Bootstrap 4 in my project.

It seems that the bundled version of jQuery that is included in the generated "bundle.js" file from your instructions isn't working with Bootstrap 4.  My Bootstrap navbar is now broken (none of the Javascript components work properly -- for example, responsive navbar won't expand).  When I explicitly include jQuery (again) in my layout, the navbar works but all of my Kendo components are now broken.

How can I reconcile this?  In what order should I place my CSS and JS?  How can I use jQuery from the bundle with my project?

Here is my code snippet.

01.<html>
02.<head>
03.    ...
04.    <link href="~/lib/twitter-bootstrap/css/bootstrap.min.css" rel="stylesheet" />
05.    <script src="~/bundle.js"></script>
06.    ...
07.</head>
08.<body>
09.    ...
10.    <script src="~/lib/twitter-bootstrap/js/bootstrap.bundle.min.js"></script>
11.</body>
12.</html>

 

Thanks,
Brian

Brian
Top achievements
Rank 2
Iron
 answered on 21 Mar 2020
3 answers
413 views

Hello,

 

I have the following grid and the Read method is working fine but when I try to delete or edit a record the button doesn't call the method from the controller.

Can you please advise ?

Here is the .cshtml

<kendo-grid name="OverTime">
    <toolbar>
        <toolbar-button name="create" text="Add new Overtime"></toolbar-button>
    </toolbar>
    <columns>
        <column field="Id" title="ID" />
        <column field="RecordDate" format="{0:MM/dd/yyyy}" title="Record Date" />
        <column field="TimeFrom" title="Time From" />
        <column field="TimeTo" title="Time To" />
        <column field="NumberOfHours" title="Number of hours" />
        <column field="OvertimeReason" title="Overtime Reason" />
        <column>
            <commands>
                <column-command text="delete" name="destroy"></column-command>
                <column-command text="update" name="update"></column-command>
            </commands>
        </column>
    </columns>
    <datasource type="DataSourceTagHelperType.Ajax" page-size="20">
        <schema>
            <model id="Id">
                <fields>
                    <field name="RecordDate" type="date"   />
                    <field name="TimeFrom" type="time" />
                    <field name="TimeTo" type="time" />
                    <field name="NumberOfHours" type="number" />
                    <field name="OvertimeReason" type="string" />
                </fields>
            </model>
        </schema>
        <transport>
            <read url="@Url.Action("Read_Overtime","OverTimes",  new { id = ViewContext.RouteData.Values["Id"] })" />
            <destroy url="@Url.Action("Destroy_Overtime","OverTimes")" />
            <update url="@Url.Action("Update_Overtime","OverTimes")" />
        </transport>
    </datasource>
    <groupable enabled="true" />
    <sortable enabled="true" />
    <pageable button-count="5" refresh="true" />
    <filterable enabled="true" />
    <editable enabled="true" />
    <toolbar>
    </toolbar>
</kendo-grid>

 

 

Here is the update and delete method from the controller.

 

        [HttpPost]
        public ActionResult Destroy_Overtime ([DataSourceRequest]DataSourceRequest request, OverTimeViewModel overTime)
        {
            try
            {
                OverTime over = _context.OverTime.Find(overTime.Id);
                if (over == null)
                {
                    return Json("Employee Not Found");
                }

                _context.OverTime.Remove(over);
                _context.SaveChanges();
                return Json(_context.OverTime.ToList());
            }
            catch (Exception ex)
            {
                return Json(ex.Message);
            }
        }

        [HttpPost]
        public ActionResult Update_Overtime([DataSourceRequest]DataSourceRequest request, OverTime overTime)
        {

            try
            {
                if(ModelState.IsValid)
                {
                    
                    _context.Entry(overTime).State = EntityState.Modified;
                    _context.SaveChanges();
                    return Json(new[] { overTime }.ToDataSourceResult(request, ModelState));
                }
                else
                {
                    return Json(_context.OverTime.ToList());
                }
            }
            catch(Exception ex)
            {
                return Json(ex.Message);
            }
        }

Nikolay
Telerik team
 answered on 20 Mar 2020
1 answer
85 views

Problem :

Destroy doesn't go to the controller, What am i doing wrong?

Read function works fine.

Grid :

<kendo-datasource name="dateSource2" type="DataSourceTagHelperType.Ajax" server-operation="false">
        <transport>
            <read url="/Begroting/GetBegrotingWijzigingen?filterElement=2-9" />
            <destroy url="/Begroting/RemoveBegrotingWijziging" />
        </transport>
        <schema>
            <model id="Id">
            </model>
        </schema>
    </kendo-datasource>
 
    <kendo-grid name="grid2" datasource-id="dateSource2">
        <groupable enabled="false" />
        <sortable enabled="true" />
        <scrollable enabled="true" />
        <filterable enabled="true" />
        <pageable button-count="5" refresh="true" page-sizes="new int[] { 5, 10, 20, 50, 100 }">
        </pageable>
        <columns>
            <column field="Datum" title="Datum" />
            <column field="Afdeling" title="Afdeling" />
            <column field="Combinatie" title="Combinatie" />
            <column field="Bedrag" title="Bedrag" />
            <column field="Toelichting" title="Toelichting" />
            <column>
                <commands>
                    <column-command text="Delete" name="destroy"></column-command>
                </commands>
            </column>
        </columns>
    </kendo-grid>

 

Controller :

[HttpPost]
   public IActionResult RemoveBegrotingWijziging([DataSourceRequest] DataSourceRequest request, BegrotingRecord begrotingRecord)
   {
       if (!begrotingRecord.Naarcoda)
       {
           _rW.BegrotingRepository.RemoveBegrotingRecord(begrotingRecord.Id);
       }
 
       return Json("OK");
   }
Tsvetomir
Telerik team
 answered on 19 Mar 2020
1 answer
264 views

Hi,

We recently updated our .NET Core web app from Kendo UI v2019.3.1023 to Kendo UI v2020.1.219. The code snippet below used to produce a checkbox and label that didn't wrap, but after the update the label wraps onto a second line if the width of the window is decreased. I have confirmed that the source of the change is in kendo.bootstrap-v4.min.css by copying the contents of the Kendo UI v2019.3.1023 kendo.bootstrap-v4.min.css back into the project and observing that no wrapping occurs. Was this an intended change in behaviour? Is there anything we can do other than to add a white-space: nowrap style to every single col class that has a Kendo CheckBoxBuilder in it?

Kind regards,

David

<div class="row align-items-center p-1">
        <div class="col-4">Header</div>
        <div class="col-2">
            @Html.Kendo().CheckBox().Name("CheckboxName").Label("Checkbox")
            @Html.HiddenFor(model => model.Checkbox)             
        </div>
Denitsa
Telerik team
 answered on 18 Mar 2020
5 answers
1.0K+ views

Scheduler Resource Binding using DataSource not displaying Employee.  Where are the examples?  I need an example that doesn't use BindTo.  Also where are the Asp.Net Core 2 examples?  all are for Asp.net 1

 

@(Html.Kendo().Scheduler<SalonWeb.Models.TimeBlock>()
    .Name("scheduler")
    .Date(DateTime.Now)
    .StartTime(DateTime.Now)
    .Height(600)
    .MajorTick(60)
    .Views(views =>
    {
        views.DayView();
        views.WeekView();
        views.MonthView();
    })
    .Resources(resource =>
    {
        //reading but not displaying
        resource.Add(m => m.Employee)  //employee object
            .Title("Employee") //descriptive title
            .DataTextField("Name") //property in Employee Object
            .DataValueField("Id") //property in Employee Object
            .DataColorField("Color") //property in Employee Object
            .DataSource(ds => ds
                .Read("Read", "Employees") //Read function in Employee controller
            );
    })
    .DataSource(d => d
        .Model(m => {
            m.Id(f => f.Id);
            m.Field(f => f.Title).DefaultValue("No title");
            m.Field(f => f.Employee);
        })
        .Read("Read", "TimeBlocks")
        .Create("Create", "TimeBlocks")
        .Update("Update", "TimeBlocks")
        .Destroy("Delete", "TimeBlocks")
    )
)

TimeBlock controller 

public async Task<IActionResult> Create([DataSourceRequest] DataSourceRequest request, TimeBlock timeBlock)
        {
            if (ModelState.IsValid)
            {
                _context.Add(timeBlock);
                await _context.SaveChangesAsync();
            }
            return Json(await new[] { timeBlock }.ToDataSourceResultAsync(request, ModelState));
        }


Employee Controller

public async Task<IActionResult> Read([DataSourceRequest] DataSourceRequest request)
        {
            return Json(await _context.Employee.ToDataSourceResultAsync(request));
        }
Martin
Telerik team
 answered on 17 Mar 2020
1 answer
318 views

Hello Everyone, 

we need to use drill down functionality in .net core application. but no solution found any one help me how to use ?

I found one solution but it's using webforms.

https://demos.telerik.com/aspnet-ajax/htmlchart/examples/drilldownchart/defaultcs.aspx

 

 

Alex Hajigeorgieva
Telerik team
 answered on 17 Mar 2020
24 answers
443 views

When trying to select an image from the root folder everything is fine, however when selecting an images from a sub-folder the return path is wrong because it includes to following code %2F between the folder name and the image name instead of the /

This was tried under the Telerik demo site and as well as locally.

Veselin Tsvetanov
Telerik team
 answered on 16 Mar 2020
2 answers
886 views

Using either html or tag helper, the width and height seem to only accept px.  Dialog for other products accept %.  Does Dialog for Asp.Net Core accept %? 

If I edit the output HTML using browser devtools, percentage works fine.  So I'm guessing I'm just missing something.  

Brian
Top achievements
Rank 1
 answered on 12 Mar 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?