Telerik Forums
UI for ASP.NET MVC Forum
0 answers
102 views

Asp.net mvc kendo rating control shwoing 1 star by default even though value is zero 

This code is integrated in kendo grid 

below is the code

columns.Bound(p => p.Rating).Title("Rating").Editable("returnFalse")
                                                 .ClientTemplate(Html.Kendo().Rating()                                                                                                       
                                                     .Name("llrating_#=SpreadsheetVersionDataId#")
                                                     .Label(false)
                                                     .Tooltip(true)                                                     
                                                     .HtmlAttributes(new { data_bind = "value:Rating" })
                                                     .Selection("continuous")                                                      
                                                     .ToClientTemplate().ToHtmlString()
                                                 );
Sudheer
Top achievements
Rank 1
 asked on 21 May 2024
1 answer
137 views

Kendo UI for JQuery MVC 2024.1.319 upgraded in WebApp to .NET 4.6.2. Runs fine in VS 2019, but when deployed to web server, the, the Date and Time pickers don't appear when editing a Grid cell DateTime field, instead it just has a text box with the likes of "Wed May 08 2024 01:30:00 GMT-0400 (Eastern Daylight Time)".  I've compared the Dev build (which works) to the Production deployment, and all the files match up. Which suggests that something is out of date or missing. Not seeing any errors in the Developer's Tools' Console (other than some cookies being blocked, which sounds unrelated).

Kendo.MVC.resource.dll (Kendo.MVC.Web) shows version 2024.1.319.545 with in the Bin folder under IIS, so it seems like at least that much is what is expected - could I have ended up with a mixed bag of Kendo libraries or scripts?  How would I tell?

I am new to Kendo UI, so this may be a pretty obvious thing, but I've just about exhausted the obvious and simple things I can think of to check!

Thanks in advance!!

Walter
Top achievements
Rank 2
Iron
 updated answer on 16 May 2024
1 answer
342 views

In my cshtml view, I have this kendo mvc grid control below.

@(Html.Kendo().Grid<MyModel>()
  .Name("mygriddata")
  .Columns(column =>
  {
      column.Bound(model => model.MyData).Title("No.").....
  })
    .Pageable(x => x.PageSizes(true).ButtonCount(3).Responsive(false))
    .AutoBind(false)
    .Filterable()
    .Sortable(x => x.Enabled(true))
    .Resizable(resizable => resizable.Columns(true))
    .Scrollable(x => x.Height("auto"))
    .PersistSelection()
    .HtmlAttributes(new { style = "height: 50vh; margin-left:10px", @class = "form-group" })
    .NoRecords()
    .DataSource(dataSource => dataSource
        .Ajax()
        .ServerOperation(true)
        .Model(model =>
        {
            model.Id(item => item.ID);
        })
        .Read(read => read.Action("MyActionMethod", "MyController"))
    )
)

In in my controller, I have this async task action method.

public async Task<JsonResult> MyActionMethod([DataSourceRequest] DataSourceRequest request)
{
    var data = await _service.GetData();
     var model = data.Select((item, index) => new MyModel
                    {
                        MyData = ......
                    });

    return new JsonResult { Data = model.ToDataSourceResultAsync(request), MaxJsonLength = int.MaxValue, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}

Then, when accessing the view, I got this error. How to set up the Kendo mvc grid control in this case?

Message: The asynchronous action method 'MyActionMethod' returns a Task, which cannot be executed synchronously.

Mihaela
Telerik team
 answered on 15 May 2024
1 answer
133 views

I am trying to update my spreadsheet based on the jsonData i get from my controller.

Controller data:


public ActionResult GetDoubleCombinations(Telerik.Web.Spreadsheet.Workbook jsonData, int id)
{

    foreach (var sheet in jsonData.Sheets)
    {
        var columnCount = sheet.Columns.Count;
        var rowCount = sheet.Rows.Count;

        for (int i = 2; i < columnCount; i++)
        {
            var expressionTop = expressionService.GetExpressionByName(sheet.Rows[1].Cells[i].Value.ToString(), id);
            var parameterTop = expressionTop.FK_ParameterID;

            for (int j = 2; j < rowCount; j++)
            {
                var expressionLeft = expressionService.GetExpressionByName(sheet.Rows[j].Cells[1].Value.ToString(), id);
                var parameterLeft = expressionLeft.FK_ParameterID;

                if (parameterTop == parameterLeft)
                {
                    var position = sheet.Rows[i].Cells[j];
                    position.Enable = false;
                    position.Background = "#d3d3d3";
                }
            }

        }
        
    }
    return Json(new { success = true, data = jsonData });
}

this is what i get in my view:


function getDoubleCombinations() {

    var spreadsheet = $("#matrix").data("kendoSpreadsheet");
    const urlParams = new URLSearchParams(window.location.search);
    const id = urlParams.get('analysisId');

    $.ajax({
        url: "@Url.Action("GetDoubleCombinations", "Matrix")",
        data: JSON.stringify({
            jsonData: spreadsheet.toJSON(),
            id: id
        }),
        contentType: "application/json",
        type: "POST",
        success: function (response) {
            spreadsheet.fromJSON(response.data);
        },
        error: function () {
            alert("Error loading data.");
        }
    });
}

I use "spreadsheet.fromJSON" to update my spreadsheet.

My spreadsheet:


@model Telerik.Web.Spreadsheet.Workbook
@(Html.Kendo().Spreadsheet()
    .Name("matrix")
    .HtmlAttributes(new { style = "width:100%" })
    .BindTo(Model)
    .Toolbar(t =>
    {
        t.Home(h =>
        {
            h.Clear();
            h.ExportAs();
        });
        t.Data(false);
        t.Insert(false);
    })
)

My problem is, that the spreadsheet is not updated.

In the attachement i have a screenshot of my jsonData.

Alexander
Telerik team
 answered on 15 May 2024
1 answer
510 views

Hi,

After update from 2023.3.718 to 2024.1.319 I could no longer see icons. I understand that there has been a switch to svg icons.

I use icons like this in grid columns

columns.Bound(p => p.Id).ClientTemplate("" +

"<a href='" + @Url.Action("Details", "Orders", new { id = "#=Id#" }) + "'target='_blank' '><i title ='Show details' class='k-icon k-i-detail-section'></i></a>")

Could you please modify code above so I can understand how to use svg icons instead?

/Br. Anders

Alexander
Telerik team
 answered on 13 May 2024
0 answers
67 views

Is there a way to determine what kind of kind of control you have using JavaScript.  For example , if you have a form with several different kendo controls

.data("kendoNumericTextBox")

.data("kendoComboBox")

.data("kendoButton")

I only have the name and id of the control. Is there a way to determine what kind of kendo control that is represented.

I have tried looking through the  jquery selection but I do not see any thing that indicates whether the selection is a kendoNumericTextBox, kendoComboBox etc...

Sean
Top achievements
Rank 1
Iron
Iron
 asked on 12 May 2024
1 answer
131 views

I have a Kendo tabstrip with partial views. When I click on the tab, the partial views are loaded. But I need to set the focus() and/or tabindex to a specific element in the partial view, for example the first text box. I tried setting the tabindex to 1 in the partial view. But that does Not seem to work.

There seems to be 2 TabStrip methods for loading a partial views ?

.LoadContentFrom("CustomerEdit"... and .Content(@<text> @Html.Partial("OrdersEdit"

I think the LoadContentFrom is Ajax.

Using Content(@<text> @Html.Partial("OrdersEdit"**... how can I set the focus to my first textbox on the the OrdersEdit.. I tried setting tabindex =1 and tried this:

 $(document).ready(function () {
    $('#firstTextBox').focus();
}

But does not work.

Anton Mironov
Telerik team
 answered on 09 May 2024
0 answers
86 views

Hi! I have a Kendo UI Filter with a column bound with a DropDownList. Everything works fine, except the ExpressionPreview gives me "[object Object]". I read that I could use the PreviewFormat, but I have no clue about how that works if it's not for numeric values. Your documentation is very thin about the subject. Can you tell me how could I see the property set as DataTextField in the preview? Or at least the DataValueField.

My razor looks like :

 @(Html.Kendo().Filter<OrderSearchBindingModel>()
.Name("filter")
.ApplyButton()
.ExpressionPreview()
.MainLogic(FilterCompositionLogicalOperator.Or).Fields(f =>
  {

      f.Add(x => x.Symbole).Label("My values list").Operators(c => c.String(x => 
                          x..Contains("Contient")).EditorTemplateHandler("getSymboleList")
}).DataSource("source"))

 

And the script containing the dropdown logic is like this :


.kendoDropDownList({
                dataTextField: "SymboleDisplayName",
                dataValueField: "Symbole",
                dataSource: {
                    type: "json",
                    transport: {
                        read: "https://myodataurl.com/symbols/getSymbols"
                    },
		    schema: {
			data: "value"
		    }
                }
            });

 

Note that my datasource is an OData query, so I defined a schema with data: "value" in my kendo.data.DataSource object as well as type: "json". The type is aslo specified in the transport.read preperties datatype: "json"

Patrice Cote
Top achievements
Rank 1
 updated question on 08 May 2024
1 answer
82 views

This is for ASP.NET MVC

 

I have a grid that on scrolling hits the controller and does true sql paging.  So each time you scroll it hits the controller that calls sql and gets the next 100 rows of data. This was working fine until we upgraded from a 2019 version of Kendo to the 2024.1.130.545 version.  It all still works but as you scroll it gets slower and slower with each group of 100, the sql calls are all still fast but loading the data on the screen slows down exponentially on each set of 100.

This is the grid code we have set.

.NoRecords(x => x.Template("<div class='empty-grid' style='height: 300px; padding-top: 50px'>There are no units that match your search criteria. <br /><br /> Please expand your search criteria and try again.</div>"))
.Sortable(sortable => sortable.Enabled(true).SortMode(GridSortMode.SingleColumn))
.ColumnMenu()
.Resizable(resize => resize.Columns(true))
.Filterable(filterable => filterable
.Mode(GridFilterMode.Row)
.Extra(false)
.Operators(operators => operators
    .ForString(str => str.Clear()
        .Contains("Contains")
        .StartsWith("Starts with")
        .IsEqualTo("Is equal to")
        .IsNotEqualTo("Is not equal to")
        .DoesNotContain("Does Not Contain")
        .EndsWith("Ends WIth")
        .IsEmpty("Is Empty")
    ))
)

.Reorderable(reorder => reorder.Columns(true))
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Single))
.Scrollable(scrollable => scrollable.Endless(false).Height(600))
.ToolBar(tools => tools.Excel())
.Excel(excel => excel
    .FileName("UnitSearchExport.xlsx")
    .Filterable(true)
    .AllPages(true)
    .ProxyURL(Url.Action("Excel_Export_Save", "Functions"))
)
.DataSource(dataSource => dataSource
.Ajax()
.AutoSync(false)
.ServerOperation(false)
.Model(model =>
{
    var Modelinfo = new Infinity.Vehicle.Inventory.Vehicles_Listing.VehicleListInfo();
    var Stock_Number = Modelinfo.Stock_Number;

    model.Id(p => Stock_Number);
}))
.Events(e => e
    .Filter("UnitInventoryListInfiniteScrollGrid_OnFiltering")
    .Sort("UnitInventoryListInfiniteScrollGrid_OnSorting")
    .ExcelExport("UnitInventoryListInfiniteScrollGrid_OnExcelExport")
    .DataBound("UnitInventoryListInfiniteScrollGrid_OnDataBound")
))

 

 

Then on Scroll it basically does this.

  var dataSourceUnitListing = new kendo.data.DataSource({
      data: [
          response.Listing
      ]
  });

  unitListingGrid.dataSource.data().push.apply(unitListingGrid.dataSource.data(), dataSourceUnitListing.options.data[0]);

  amountOfUnitsShownOnGrid = unitListingGrid.dataSource.view().length;

Anton Mironov
Telerik team
 answered on 07 May 2024
1 answer
74 views

In rich text editor does kendo support the layout column selection same as we have option in word like this

does kendo mvc rich text editor support that if yes please let us know how ?

Mihaela
Telerik team
 answered on 01 May 2024
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?