Telerik Forums
UI for ASP.NET Core Forum
3 answers
473 views

The objective is to keep certain functions(open, download, span) off the toolbar and add other buttons to the toolbar (email, close).  Does anyone know how to add the ZoomCommand to the toolbar?

The following is what I have so far.

 

        <kendo-pdfviewer name="kendoPdfViewer" id="kendoPdfViewer">
            <pdfjs-processing file=@(Url.Content("/YourPage?handler=PdfHandler")) />
            <toolbar enabled="true">
                <pdfviewer-toolbar-items>
                    <pdfviewer-toolbar-item command="OpenCommand" type="button" name="open" icon="folder-open"></pdfviewer-toolbar-item>
                    <pdfviewer-toolbar-item command="PageChangeCommand" type="pager" name="pager"></pdfviewer-toolbar-item>
                    <pdfviewer-toolbar-item command="DownloadCommand" type="button" name="download" icon="download"></pdfviewer-toolbar-item>
                    @*The below commands have not been implemented.  Feel free to answer how the below is implemented.*@
                    @*<pdfviewer-toolbar-item command="EnableSelectionCommand"></pdfviewer-toolbar-item>*@
                    @*<pdfviewer-toolbar-item command="EnablePanCommand"></pdfviewer-toolbar-item>*@
                    @*<pdfviewer-toolbar-item command="ExportCommand"></pdfviewer-toolbar-item>*@
                    @*The above commands have not been implemented.*@
                    <pdfviewer-toolbar-item command="PrintCommand" type="button" name="print" icon="print"></pdfviewer-toolbar-item>
                    <pdfviewer-toolbar-item command="OpenSearchCommand" type="button" name="search" icon="search"></pdfviewer-toolbar-item>
                    @* How do you implement the ZoomCommand? *@
                    <pdfviewer-toolbar-item command="ZoomCommand" name="zoom"></pdfviewer-toolbar-item>
                    <pdfviewer-toolbar-item type="button" id="button1" text="Email" click="EmailClickHandler"></pdfviewer-toolbar-item>
                    <pdfviewer-toolbar-item type="button" id="button2" text="Close" click="CloseClickHandler"></pdfviewer-toolbar-item>
                </pdfviewer-toolbar-items>
            </toolbar>
        </kendo-pdfviewer>

<style>
    html body #kendoPdfViewer {
        width: 100% !important;
    }
</style>

<script>
        function EmailClickHandler(e) {
            console.log("EmailClickHandler");
        }
        function CloseClickHandler(e) {
            console.log("CloseClickHandler");
        }

    </script>

I added Open and Download just to get them working.  I will remove them before the production release.

Does someone know how to define the ZoomCommand?

Petar
Telerik team
 answered on 07 Oct 2020
2 answers
112 views

I have this control

 

 

@(Html.Kendo().DropDownTreeFor(model=>model.NewCustomerCategoryCode)
                        .DataTextField("Name")
                        .DataValueField("id")
                        .AutoWidth(true)
                        .HtmlAttributes(new { style = "width: 100%" })
                        .DataSource(dataSource => dataSource
                            .Read(read => read
                                .Action("Read_DropDownTreeNewCustomerCategoriesData", "ListBox")
                            )
                        )
                        .Filter(FilterType.Contains)
                        .LoadOnDemand(true)
                    )

 

And this is the action

public JsonResult Read_DropDownTreeNewCustomerCategoriesData(string id)
        {
            var result = GetHierarchicalNewCustomerCategoryData()
                .Where(x => String.IsNullOrEmpty(id) ? x.ParentCode == null : x.ParentCode == id)
                .Select(item => new {
                    id = item.Code,
                    Name = item.Name,
                    hasChildren = item.HasChildren
                });
 
            return Json(result);
        }

 

I set correctly a value (and stored to database), but when I reopen a card it cannot get a value correctly.

When I try to debug into Action id parameter is not valued.

Why?

 

Dario
Top achievements
Rank 1
Veteran
 answered on 06 Oct 2020
2 answers
276 views

I'm using your loader when I disable forms after an entry/submit.  But, I also use your Grid so I'd like the same "progress indicator" used while waiting for the grid datasource to return.  So, how do I make the Loader use the same animation as the Grid or how do I make the Grid use the Loader?

Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
 answered on 06 Oct 2020
4 answers
256 views

I want to disable a combobox.  I have my example below.  The only way I see to do it is through a script, also shown.  If this script isn't the best way I'm open to suggestions.

However, for my script to work I need to know the id of the control.  My approach was picked up off other posts but doesn't seem to do anything.

ComboBox:

@(Html.Kendo().ComboBoxFor(x => x.Item.CountryCode)
    .Placeholder("Select Country...")
    .DataTextField("Name")
    .DataValueField("Code")
    .Filter(FilterType.Contains)
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("GetCountries", "Persons");
        });
    })
    .HtmlAttributes(new { style = "width: 100%", @id = "countryCodes" }))

 

What I get when I press F12 and get the source in the browser:

<span class="k-widget k-combobox k-combobox-clearable" style="width: 100%;"><span tabindex="-1" unselectable="on" class="k-dropdown-wrap k-state-default"><input name="Item.CountryCode_input" class="k-input" type="text" autocomplete="off" title="" role="combobox" aria-expanded="false" placeholder="Select Country..." style="" tabindex="0" aria-disabled="false" aria-readonly="false" aria-autocomplete="list" aria-owns="countryCodes_listbox" aria-busy="false" aria-activedescendant="79fa18f7-e213-4d76-be7a-e4eb980f85f2"><span unselectable="on" class="k-icon k-clear-value k-i-close k-hidden" title="clear" role="button" tabindex="-1"></span><span unselectable="on" class="k-select" aria-label="select" role="button" tabindex="-1" aria-controls="countryCodes_listbox"><span class="k-icon k-i-arrow-60-down"></span></span></span><input id="countryCodes" name="Item.CountryCode" style="width: 100%; display: none;" type="text" value="" data-role="combobox" aria-disabled="false" aria-readonly="false"></span>

 

Form definition & Script:

<form asp-action="Edit" asp-all-route-data="routeKeys" onsubmit="onSubmit()">
...
 
<script>
 
    function onSubmit(e) {
 
        $("#name").attr("disabled", true);
        $("#Item_CountryCode").attr("disabled", true);
...

 

Ivan Danchev
Telerik team
 answered on 06 Oct 2020
7 answers
1.0K+ views
When I hit a button that takes a long time I'd like to show a Busy Indicator that disables the form... like what you have for your other products.  Any idea how I would accomplish this for ASP.NET Core 3.1 MVC?
Neli
Telerik team
 answered on 06 Oct 2020
1 answer
333 views

I'm trying to create a dropdownlist like in the attached image. The button launches the dropdown and each dropdown item is an action that launches a javascript function. Is this possible with .Net Core?

 

 

Neli
Telerik team
 answered on 06 Oct 2020
1 answer
362 views

Hi, I'm using ASP.Net Core Scheduler and I'm wondering how to change the background colour of Saturday and Sunday to represent the weekend within the Month View. I want the month view to look like what Saturday and Sunday look like in the week view.

Is this possible? 

Dimitar
Telerik team
 answered on 05 Oct 2020
1 answer
126 views

It seems that property settings are ignored.

  • Switch is supposed to say YES/NO but no text is visible.
  • NumericTextBox Max, Min, Step are all ignored.

My form:

    @(Html.Kendo().Form<Customer>()
    .Name("form")
    .HtmlAttributes(new { action = "Layout", method = "POST" })
    .Validatable(v =>
    {
        v.ValidateOnBlur(true);
        v.ValidationSummary(vs => vs.Enable(true));
    })
    .Items(items =>
    {
        items.AddGroup()
            .Label("Registration")
            .Grid(g => g.Cols(1).Gutter(10))
            .Items(i =>
            {
                i.Add()
                     .Field(f => f.Name)
                     .Label(l => l.Text("Name:").Optional(false));
                i.Add()
                    .Field(f => f.TwoFactorEnabled)
                    .Label(l => l.Text("Multi-factor Required:"))
                    .Editor(e =>
                    {
                        e.Switch().Messages(c => c.Checked("YES").Unchecked("NO"));
                    });
            });
 
        items.AddGroup()
            .Label("Licensing")
            .Items(i =>
            {
                i.Add()
                    .Field(f => f.MaximumUserCount)
                    .Label(l => l.Text("Maximum User Count:").Optional(true))
                    .Editor(e =>
                    {
                        e.NumericTextBox().Max(1000).Min(0).Format("n0").Decimals(0).Step(10);
                    });
                i.Add()
                    .Field(f => f.LicenseActivationTimestamp)
                    .Label(l => l.Text("License Activation:").Optional(true))
                    .Editor(e => e.DatePicker()
                        .HtmlAttributes(new {style = "width: 100%", title = "datepicker"})
                        //.Format("MM/dd/yyyy")
                        .DateInput(true));
                i.Add()
                    .Field(f => f.LicenseRenewalTimestamp)
                    .Label(l => l.Text("License Renewal:").Optional(true))
                    .Editor(e => e.DatePicker()
                        .HtmlAttributes(new { style = "width: 100%", title = "datepicker" })
                        .Format("MM/dd/yyyy")
                        .DateInput(true));
            });
    })
    .Events(ev => ev.ValidateField("onFormValidateField").Submit("onFormSubmit").Clear("onFormClear"))
)
Ivan Danchev
Telerik team
 answered on 02 Oct 2020
1 answer
107 views

I have the following Grid.  I need the record/row to be selected on the Grid by default when I go onto this View.  On the Databound Event, I have javascript that works against a Grid assuming I have 1 page.  But, how do I do this when I have multiple pages and the row I want is on Page N?

 

 

@(Html.Kendo().Grid<Person>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Command(command => command
            .Custom("Select")
            .Click("goDetail"))
            .Width(Glossary.Portal.ButtonWidth);
        columns.Bound(p => p.FirstName)
            .Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")
                .ShowOperators(false)
                .SuggestionOperator(FilterType.Contains)));
        columns.Bound(p => p.LastName)
            .Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")
                .ShowOperators(false)
                .SuggestionOperator(FilterType.Contains)));
    })
    .Pageable()
    .Selectable(s => s.Mode(GridSelectionMode.Single))
    .Sortable()
    .Scrollable()
    .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
    .HtmlAttributes(new { style = "height:550px;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Read(read => read.Action("IndexJson", "Patients").Data("getData"))
        .Model(m => m.Id(p => p.Id))
    ).Events(e =>
    {
        e.DataBound("onGridDataBound");
        e.Change("goGridSelect");
    }))

 

...

    function onGridDataBound(e) {
        // Handle the dataBound event.
        var grid = e.sender;
        //alert(grid == null);

        var personId = $("#personId").val();
        //alert(personId);

        if (grid != null) {
            var dataItem = grid.dataSource.get(personId);
            //alert(dataItem == null);

            if (dataItem != null) {
                var row = $("tr[data-uid='" + dataItem.uid + "']");
                //alert(row == null);

                if (row != null) {
                    grid.select(row);
                    row[0].scrollIntoView();
                }
            }
        }
    }

Petar
Telerik team
 answered on 02 Oct 2020
1 answer
198 views

Hello,

Our team is in the middle of upgrading our applications from ASP.NET MVC 5 to ASP.NET Core 3.1. One of our applications uses the Kendo Editor which we use to store files within our database. We previously used the example provided on Github (https://github.com/telerik/ui-for-aspnet-mvc-examples/blob/master/editor/database-image-browser/DatabaseImageBrowser/Controllers/ImageBrowserController.cs) to store the files in our database. However, when we tried to convert this code to .NET Core, it appears that some of the classes and functions related to image resizing and creating thumbnails do not exist for .NET Core. Specifically the Kendo.Mvc.UI.ImageSize and Kendo.Mvc.UI.ThumbnailCreator classes. Are their any comparable classes/functions that I can use that are compatible with .NET Core?

Please let me know.

Thanks,

Mike

Ivan Danchev
Telerik team
 answered on 02 Oct 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?