Telerik Forums
UI for ASP.NET MVC Forum
1 answer
215 views

In my MVC Kendo-Grid web app, I need to periodically see if certain data in the underlying database has expired. If it has, then I modify the data in the database and the normal "refresh" cycle of the Grid updates the displayed data. So, here is my server-side method, contained in my GridController.cs (from the "Controller" part of MVC), abridged:

namespace WireDashboard2.Controllers
{
    public partial class GridController : Controller
    {

....

        [System.Web.Services.WebMethod]
        public static void ReviewSuspensions()
        {
            ... do some database stuff ....
        }

....

}

And here is the client-side JavaScript method that is supposed to be calling GridController.ReviewSuspensions() method:

    function Check4ExpiredSuspensions() {
        $.ajax({
            url: '@Url.Action("GridController", "ReviewSuspensions")',
            success: function() {
                    alert("Reviewed Suspensions successfully!");
            },
            error: function() {
                    alert('Did NOT review Suspensions successfully.');
            }
        }); // GET http://localhost:63794/GridController/ReviewSuspensions 404 (Not Found)
    }

I know the "Check4ExpiredSuspensions() JavaScript is being called on the client-side, because it is attempting to invoke the method, resulting in a 404 (Not Found) error being returned. That JavaScript function is from the WireDashbard2\Views\Home\Index.cshtml file (the "View" part of MVC).

I've tried literally a dozen modifications of the Client-Side and Server-Side (based on lots of different methods found online), and it never hits a breakpoint in the server-side method. Most of those methods look like FM to me because I don't have a good handle on the mapping between the "web" reference to the GridController and Check4Suspensions() method as viewed from the client side - so I am mostly just trying to match up from examples.

I inherited the web app, and it is a combination of Microsoft C# Windows web application now using .NET 4.6.2, Entity Framework 6.x, JQuery 3, Kendo UI for JQuery MVC 2024.1.319, running (in Prod) under WIndows Server 2016 Standard and IIS, so there seems to be plenty of potential for difficult interactions!  Problem occurs using both Chrome and Edge (no surprise really there, same engine in both).

Thanks!

 

Eyup
Telerik team
 answered on 21 May 2024
1 answer
197 views

We are using the below .dlls as standalone .dlls (Not from Nuget package installation) In a .Net Framework Web Forms Application

We want to migrate/upgrade to .Net framework 4.8

Are these Dlls backwards compatible or should i use new versions of these dlls that will be compatible with .Net Framework 4.8?

  • Telerik.Web.Design, Version=2013.2.717.40
  • Telerik.Web.UI, Version=2013.2.717.40
  • Telerik.Web.UI.Skins, Version=2013.2.717.40

Thanks!

Rumen
Telerik team
 answered on 21 May 2024
0 answers
124 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
185 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
382 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
146 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
572 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
88 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
158 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
109 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
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
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
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
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
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?