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

I'm trying to build an interface where I change the grid's datasource based on a drop down.  The datasource is dynamic (meaning I don't know what columns will returned).

If I use the kendo.data.DataSource set to a static set of JSON data, it populates during the on_change event properly. 

If I use an external source... nothing happens.  The data is fetched from the server, but nothing renders.  I'm really stuck.  

I dumbed it down to raw basics... but still no progress.  Can someone spot my mistake or give me advice?  

I suspect something to do with the DataSourceRequest parameter.... but I can't spot it.

Thanks!

Sam

 

 @(Html.Kendo().Grid<dynamic>()    
            .Name("logViewGrid")
            .Pageable(pager => pager
                    .Input(false)
                    .ButtonCount(4)
                    .PageSizes(new int[] {5, 10, 20, 100, 500})
                    .AlwaysVisible(false)
            )
            .Sortable()
            .ToolBar(t => {
                    t.Excel();
                    t.Search();
            })
            .Excel(excel => excel
                .AllPages(true)
            )
            .Scrollable()
            .Filterable(ftb => ftb.Mode(GridFilterMode.Menu))
            .HtmlAttributes(new { style = "height:430px;" })
           
        )

 

<script>

 var logDataSource2 = new kendo.data.DataSource({
            data: [
                { name: "John Doe", age: 33 },
                { name: "Joe Smith", age: 55 }
            ]
        });

    var logDataSource;

    function logViewDropdown_change() {
       var value = $("#logViewDropdown").val();
       if (value != "")
       {
           logDataSource = new kendo.data.DataSource({
                                type: "odata",
                                serverFiltering: true,
                                serverPaging: true,
                                serverSorting: true,
                                pageSize: 10,
                                transport: {
                                    read: {
                                        url: "/Log/GetLogDataForOne" 
                                    }
                                }
                            });   

            var grid = $("#logViewGrid").data("kendoGrid");
            grid.setDataSource(logDataSource); // this works if I set it to logDataSource2

       }

</script>

 

Here's my test controller:

    [Authorize(Roles = "Log Admin")]
    public IActionResult GetLogDataForOne([DataSourceRequest] DataSourceRequest request)
    {
        System.Collections.Generic.IEnumerable<dynamic> dynamicList;
        dynamicList = Global.SqlDataAccess.GetDynamicData("SELECT TOP 2 ActivityInformation FROM log.WebsiteActivity");
        return Json(dynamicList.ToDataSourceResult(request)); //
    }
Aleksandar
Telerik team
 answered on 18 Apr 2022
1 answer
93 views

My employer prefers us not to use cdns when possible.  I noticed that when I choose not to use the cdns the Telerik Visual Studio extension downloads alot of files into the project.   Included in this is every theme offered and all its files including images.  

Is there a way to just grab the bare minimum for things to work and not download any extra themes since I use one that I created inside of Telerik's theme builder?

Tsvetomir
Telerik team
 answered on 12 Apr 2022
1 answer
111 views

I have a maintenance grid for data where one of the columns is an "Archived?" column which should be read-only when adding a new record or editable otherwise - database/data layer will default the value to false in any case. How can I achieve that? The relevant column in my grid is defined as follows:


            columns.Bound(t => t.IsArchived).ClientTemplate("<input type='checkbox' onclick='return false;' #= IsArchived ? checked='checked' : '' # />").HtmlAttributes(new { style = "text-align: center;" }).HeaderHtmlAttributes(new { style = "text-align: center;" }).Width(140);

Tsvetomir
Telerik team
 answered on 11 Apr 2022
1 answer
798 views

Hello All,

   I have been working on an in house document editor.   However,  I am having when using PDF export getting page breaks to appear in the exported document.

I attempted creating both a custom button that would insert a <p STYLE='page-break-before: always'></p> and also just a custom formatting to use a similar style.  Neither appear to put page breaks into document when using pdf export.  Ideally, I would prefer to have it setup in  such a way that the page breaks were inserted automatically rather than manually.  Is there a way to set this up?

Additionally, I am curious about whether getting a custom footer setup for the bottom of each of these breaks is also a possibility.  However, first step is get something working for page breaks.

Thanks 

Aleksandar
Telerik team
 answered on 11 Apr 2022
1 answer
190 views

With reference to reported issue 

RichTextBox HtmlFormatProvider export overflow document (especially table),

Rad rich textbox Html Binding is not working when specific characters found in data and many other internal issues raised in RadRichTextBox in WPF with HTMLFormatProvider, we are considering to replace it with XamlFormatProvider.

We are designing our services in such way that it will provide HTML to old application while Xaml to WPF app. This can be done to export Telerik.Windows.Documents.Model.RadDocument to required format

I noticed that XamlFormatProvider is not available in Document Processing Asp.Net core. It means using WPF Radrichtext box with Web api's are not compatible. Currently we are unable to use XamlFormatProvider.

Another option we can consider to use DocxFormatProvider, but it export document as byte[], while our existing DB and web services structure accepts/response string data. So is there anyway to export DocxFormatProvider as Open Office Xml?

Another reason we cannot use byte[] or base64string in database, because we have search service. In this case we will unable to search on byte array or converted base 64 string.

 

 

Dimitar
Telerik team
 answered on 08 Apr 2022
1 answer
360 views

I have the following grid and it is properly displaying several records added to the list on page load:


@(Html.Kendo().Grid(IndexModel.logHolder.DataList)
    .Name("logGrid")
    .ToolBar(t => t.Search())
    .Columns(columns =>
    {
    columns.Bound(p => p.CreateDateTime).Title("Date/Time").Format("{0:MM/dd/yyyy hh:mm:ss}").Width(200);
    columns.Bound(p => p.ClientId).Title("Client ID").Width(150);
    columns.Bound(p => p.ClientName).Title("Client Name").Width(150);
    columns.Bound(p => p.Message).Title("Message");
    })
    .Pageable()
    .Sortable()
    .Scrollable(scr=>scr.Height(430))
    .Search(s => {
    s.Field(o => o.CreateDateTime, "eq");
    s.Field(o => o.ClientId, "eq");
    s.Field(o => o.ClientName, "contains");
    s.Field(o => o.Message, "contains");
    })
    .Filterable()
    .DataSource(dataSource => dataSource
    .Ajax()
    .PageSize(20)
    .ServerOperation(false)
    ))

I have some signalr code that is running and adding items to the list IndexModel.logHolder.DataList.  I can see in my code behind that items are in fact being added to the list.

Immediately after adding an item to the list, I am calling the following javascript to attempt to refresh the data, but it won't refresh:


function refreshData()
    {
        var grid = $("#logGrid").data("kendoGrid");
        grid.dataSource.read();
    }

What am I missing?

 

Thanks

 

 

Mihaela
Telerik team
 answered on 06 Apr 2022
1 answer
2.4K+ views

Hi Team,

In my application below jQuery version has been updated

"~/Scripts/jquery-3.6.0.min.js",
"~/Scripts/jquery-migrate-3.4.0.min.js", 

 

  After the upgraded version I am getting Uncaught TypeError: Cannot read properties of undefined (reading 'id')  this error 

In in my kendo grid like this  .Events(command => command.DataBound("onGridDataBound"))

 function onGridDataBound(e) {

        dataBoundNoResultsDisplayCheck(e);

//some custom business logic is here

}

and the error generating function is below 

 

   

function dataBoundNoResultsDisplayCheck(e) {

          switch (e.sender.table.context.id)

               {

                }

}

 

on the basis of id code is running but now after the update not able to get grid id can you help me on this finding workaround here for getting kendo grid id in event 

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 06 Apr 2022
1 answer
288 views

I am working on a media displaying application for use in-house.  The media player, as offered by Telerik, is an obvious choice.  While my initial attempts appear to be bearing fruit, I have run up against one item I cannot seem to crack.

The "toolbar" controls seem to never want to "hide".  That is when a video is displayed the controls appear to briefly overlay the videos lower portion allowing the user to adjust things.  While this is logical, they never seem to hide.

I have attempted to use the API to get a handle of the toolbar.  That works.  When I call the .hide() feature, nothing happens.

Ideally my goals are to hide both the controls and title bars.   Neither appear to be responding.

Am I missing something obvious?  While visually it is working, I am attempting to fine tune the user experience.

Here is a synopsis of the view displaying the media

@model ImageToolKit.Models.TitleModel

@{
    var urlValue = string.Format("{0}?id={1}", Url.Action("GetImageFromDb", "Home"), Model.Id);
}

    @(Html.Kendo().MediaPlayer()
        .Name("mediaPlayer")
        .AutoPlay(true)
        .Media(m => m
            .Title(Model.Title)
            .Source(@urlValue)
         )
         .Events(e => e.End("OnMediaPlayerEndOfMovieEvent"))
        .HtmlAttributes(new { style = "height:720px" })
    )

 

Tsvetomir
Telerik team
 answered on 06 Apr 2022
1 answer
304 views

I followed the direction in this forum post to disable the checkbox based on certain conditions:

https://www.telerik.com/forums/problem---select-all-checkbox-selects-disabled-row#login

Here's the runnable example:

https://dojo.telerik.com/alAtUWUb

However, when I click on the select-all checkbox, I realized selectedKeyNames() is selecting those that have been disabled.

You can verify that by adding "alert(this.selectedKeyNames().join(","));" in onChange function, and it will alert disabled checkbox id as well.

This is not desirable. How can I get the selectedKeyNames() for those checkboxes that are not selected?

Georgi Denchev
Telerik team
 answered on 06 Apr 2022
1 answer
100 views

When I configure like this

var supportedCultures = new[] { new CultureInfo("zh-CN") };//new CultureInfo("en-US"), new CultureInfo("zh-CN")

app.UseRequestLocalization(new RequestLocalizationOptions
{
    DefaultRequestCulture = new RequestCulture("zh-CN"),
    SupportedCultures = supportedCultures,
    SupportedUICultures = supportedCultures
});

and

	<link href="https://cdn.kendostatic.com/2022.1.301/styles/kendo.bootstrap-main.min.css" rel="stylesheet" type="text/css" />
	<script src="https://cdn.kendostatic.com/2022.1.301/js/jquery.min.js"></script>
	<script src="https://cdn.kendostatic.com/2022.1.301/js/jszip.min.js"></script>
	<script src="https://cdn.kendostatic.com/2022.1.301/js/kendo.all.min.js"></script>
	<script src="https://cdn.kendostatic.com/2022.1.301/js/kendo.aspnetmvc.min.js"></script>

    <script src="https://kendo.cdn.telerik.com/2022.1.301/js/cultures/kendo.culture.zh-CN.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2022.1.301/js/messages/kendo.messages.zh-CN.min.js"></script>
    <script>
        kendo.culture("zh-CN");
    </script>
</head>

The page effect is not displayed properly

I found that the second screen start of the scroll bar is not localized

But when I set it up like this


var supportedCultures = new[] { new CultureInfo("en-US") };//new CultureInfo("en-US"), new CultureInfo("zh-CN")

app.UseRequestLocalization(new RequestLocalizationOptions
{
    DefaultRequestCulture = new RequestCulture("en-US"),
    SupportedCultures = supportedCultures,
    SupportedUICultures = supportedCultures
});
_Layout.cshtml configuration remains unchanged

it shows correct

There is a problem with the product configuration documentation(https://docs.telerik.com/aspnet-core/globalization/localization)
Why is this? How can I remodel?
I use the default aspnet.core MVC project (V2022 R1 SP1)
grateful
Stoyan
Telerik team
 answered on 06 Apr 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?