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

a model is returned to the form in which parameter "Raion" bool has a value of true or false.
How to make it so that CheckBox itself takes the required value?

@(Html.Kendo().CheckBox().Name("Raion").Label("Выезд на район"))

public class ServiceViewModel
    {
*****
        public bool Raion { set; get; }
****
    }
@model service.Models.ServiceViewModel

@(Html.Kendo().CheckBox().Name("Raion").Label("Выезд на район"))




Вадим
Top achievements
Rank 1
Iron
Iron
 asked on 11 Jan 2022
1 answer
116 views

Good afternoon,

I've successfully managed to use PdfProcessing in a similar way to the demo but I want to include some error capture.  What's the best way to return the error to the View and display it e.g. if the file doesn't exist?

[HttpPost]
public ActionResult Download_Document()
{
    try
    {
        PdfFormatProvider formatProvider = new PdfFormatProvider();
        formatProvider.ExportSettings.ImageQuality = ImageQuality.High;

        byte[] renderedBytes = null;
        using (MemoryStream ms = new MemoryStream())
        {
            RadFixedDocument document = CreatePdfDocument.CreateDocument();
            formatProvider.Export(document, ms);
            renderedBytes = ms.ToArray();
        }

        return File(renderedBytes, "application/pdf", "PdfDocument.pdf");
     }
     catch (Exception e)
     {
         return e.Message;
     }
}

Kind regards,

Richard

Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
 answered on 10 Jan 2022
1 answer
796 views

HI,  

I am working on the MVC.net (not core) application.  used the few stuff from Kendo ui, like autocomplete and notification.  Everything works fine on local and when deployed to the Azure without the automated CI/CD process.

 

Now when it came to the do the build for CI/CD I am getting the below error:

ResolveAssemblyReferences: Primary reference "Kendo.Mvc". ##[warning]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2203,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "Kendo.Mvc". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2203,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Kendo.Mvc". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\a\1\s\MyApp\MyApp.csproj] For SearchPath "{HintPathFromItem}".

 

//Properties in Visual Studio for the dll

Although the code is running fine after deployment and on local but I noticed that the Telerick or Keno dlls that are sever in reference folder

are missing from the Package folder.

Anton Mironov
Telerik team
 answered on 10 Jan 2022
2 answers
4.5K+ views

I am trying to use Kendo Grid in a razor view.
I have reference for the required css and js files in bundle.config:

bundles.Add(new StyleBundle("~/Content/kendo/css").Include(
               "~/Content/kendo/kendo.common.min.css",
               "~/Content/kendo/kendo.common-bootstrap.min.css",
               "~/Content/kendo/kendo.bootstrap.min.css"
               ));
            bundles.Add(new ScriptBundle("~/Scripts/kendo/js").Include(
                    "~/Scripts/kendo/jquery.min.js",
                    "~/Scripts/kendo/kendo.all.min.js",
                    "~/Scripts/kendo/kendo.aspnetmvc.min.js"
                ));

In the View I have this:

@using Kendo.Mvc.UI;
@using Kendo.Mvc.Extensions;

@model WebApplication.Models.TMS_Categories

@{
    ViewBag.Title = "Index";
}



<h2>Index</h2>

<div class="container">
    <div class="row">

        @(Html.Kendo().Grid<WebApplication.Models.TMS_Categories>()
                                    .Name("CategoriesGrid")
                                    .Selectable()
                                            .Columns(columns =>
                                            {
                                                columns.Bound(c => c.ID).Width(50);
                                                columns.Bound(c => c.PrimaryCategoryName).Title("P Name").Width(100);
                                                columns.Bound(c => c.SecondaryCategoryName).Title("S Name").Width(100);
                                                columns.Bound(c => c.PrimaryDescription).Title("Primary Desc").Width(100);
                                                columns.Bound(c => c.SecondaryDescription).Title("Secnd Desc").Width(100);
                                                columns.Bound(c => c.Code).Width(100);
                                                columns.Bound(c => c.OrganizationID).Title("OrgID").Width(100);
                                                columns.Bound(c => c.CreatedBy).Width(100);
                                                columns.Bound(c => c.CreatedDate).Width(100);
                                                columns.Bound(c => c.UpdatedBy).Width(100);
                                                columns.Bound(c => c.UpdatedDate).Width(100);
                                                columns.Bound(c => c.IsDeleted).Width(100);
                                                columns.Bound(c => c.IsActive).Width(100);
                                                columns.Bound(c => c.IsDefault).Width(100);
                                                columns.Bound(c => c.CompanyID).Width(100);
                                                columns.Bound(c => c.CategoryType).Width(100);
                                                columns.Command(command =>
                                                {
                                                    command.Edit();
                                                    command.Destroy();
                                                }).Width(200);

                                            })
                                    .DataSource(dataSource => dataSource
                                        .Ajax()
                                        .Model(model =>
                                        {
                                            model.Id(cat => cat.ID);
                                            model.Field(cat => cat.ID).Editable(false);
                                        }
                                        )
                                        .Read(read => read.Action("GetAllCategories", "Categories"))
                                      .Update(update => update.Action("UpdateCategory", "Categories"))
                                      .Create(create => create.Action("Addcategory", "Categories"))
                                      .Destroy(destroy => destroy.Action("DeleteCategory", "Categories"))

                                        )
                                   .ToolBar(toolbar => toolbar.Create())
                                   .Editable(editable => editable.Mode(GridEditMode.InLine))
                                    .Sortable()
                                    .Selectable()
                                    .Pageable(pageable =>
                                    {
                                        pageable.Refresh(true);
                                        pageable.PageSizes(true);
                                    })
        )
    </div>
</div>

When I run the code on chrome I get an error in console and data is not bound with grid only column names are shown but not any data row is showing :

 

Uncaught TypeError: jQuery(...).kendoGrid is not a function
    at HTMLDocument.<anonymous> (Index:54)
    at i (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at Function.ready (jquery.min.js:2)
    at HTMLDocument.K (jquery.min.js:2)

and also when i click Add New Record button I get the data in this form:

 

{"Data":[{"ID":1,"PrimaryCategoryName":"a","SecondaryCategoryName":"b","PrimaryDescription":"dsa","SecondaryDescription":"fewf","Code":"123","OrganizationID":1,"CreatedBy":1,"CreatedDate":"\/Date(1562439600000)\/","UpdatedBy":1,"UpdatedDate":"\/Date(1562439600000)\/","IsDeleted":false,"IsActive":true,"IsDefault":false,"CompanyID":2,"CategoryType":3},{"ID":2,"PrimaryCategoryName":"f","SecondaryCategoryName":"g","PrimaryDescription":"ddsf","SecondaryDescription":"gfh","Code":"434","OrganizationID":3,"CreatedBy":3,"CreatedDate":"\/Date(1562439600000)\/","UpdatedBy":3,"UpdatedDate":"\/Date(1562439600000)\/","IsDeleted":true,"IsActive":false,"IsDefault":false,"CompanyID":1,"CategoryType":2}],"Total":2,"AggregateResults":null,"Errors":null}

 

Any body here to help me?

Salama
Top achievements
Rank 1
Iron
Iron
 answered on 07 Jan 2022
0 answers
163 views

https://www.telerik.com/forums/implement-dropdown-tree-co

 

I need to add default values for dropdown tree

After clicking of create button on above sample provided code

 

froger
Top achievements
Rank 1
Iron
 asked on 07 Jan 2022
1 answer
285 views

A security scan caught security vulnerabilities on several javascript files included with ASP.NET MVC version 2021.3.1109:

[1] kendo 2021.3.1109 kendo.dataviz.map.min.js

"The application's tileTitle:this._tileTitle}},wrapIndex:function embeds untrusted data in the generated output with location, at line 26"

[2] kendo 2021.3.1109 kendo.data.min.js

"The application's e},destroyed:function embeds untrusted data in the generated output with wrapAll, at line 26"

[3] kendo 2021.3.1109 kendo.aspnetmvc.min.js

"The application's !function embeds untrusted data in the generated output with href, at line 25"

[4] kendo 2021.3.1109 kendo.mobile.min.js

"The application's r.rightElement=n embeds untrusted data in the generated output with inArray, at line 35"

Can I safely exclude these files from my project?

Thanks.

Georgi
Telerik team
 updated answer on 06 Jan 2022
1 answer
636 views

I have configured an Upload control as an Async Single File (multiple = false) upload as shown below.  When I drag-n-drop multiple files (e.g., three files) into the drop zone, one of the files is uploaded. Which of the files gets uploaded seems a bit random. It's confusing to the users that they can drop multiple files and only one gets uploaded.

I thought I could could check the event parameter passed into the Upload or Success events to see if e.files length is greater than one and if it is, do a e.preventDefault() and display a warning message. However, the e.files contains only one of the files that were dropped (e.g., I drop three files and the e.files.length is one). How do I determine if multiple files were dropped?

@(Html.Kendo().Upload()
      .Name("attachments")
      .Multiple(false)
      .ShowFileList(true)
      .Async(async => async.Save("Save", "Upload").AutoUpload(true))
      .Events(events => events.Error("onError").Success("onSuccess").Upload("onUpload").Select("onSelect")))
            
Yanislav
Telerik team
 answered on 31 Dec 2021
1 answer
1.4K+ views

The kendo Grid Column datatype is string

columns.Bound(c => c.StartDate).Title("Start date").Format("{0: dd/MM/yyyy}").Filterable(f => f.Cell(c =>c.ShowOperators(false).Operator("contains").SuggestionOperator(FilterType.Contains)));

I am able to change the datatype of the Kendo Grid column from string to Date.

.DataSource(dataSource => dataSource

.Ajax()

.Model(model =>

    {

        model.Id(p => p.ID);

       model.Field("StartDate", typeof(DateTime));

 })

 

but the issue i am facing is, if the value of the string like "23/03/2020" or "15/06/2021", then no value will be displayed in the cell of the "StartDate" column of the Grid.

please help me to resolve the issue.

 

Eyup
Telerik team
 answered on 30 Dec 2021
1 answer
1.1K+ views

Hi,

as I see in the following demo it says it is loading the partial views in Tabs, not a Main View:

https://demos.telerik.com/aspnet-mvc/tabstrip/ajax

In the example they loaded different partial views in tabs like,  ajaxContent1.html, ajaxContent1.html, ajaxContent1.html.

Q1. But can I load same partial view (ajaxContent1.html) in 3 different tabs?

Q2. Can I load View other than Partial View in a Tab?

Yanislav
Telerik team
 answered on 29 Dec 2021
1 answer
1.8K+ views

I'm following this video tutorial:

https://learn.telerik.com/learn/course/external/view/elearning/3/telerik-ui-for-aspnet-mvc


My application does not appear to be rendering Kendo CSS properly. 

Here is my BundleConfig.cs

    public class BundleConfig
    {
        // For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js"));

            bundles.Add(new ScriptBundle("~/bundles/kendojs").Include(
                        "~/Scripts/kendo/2021.3.1207/kendo.all.min.js",
                        "~/Scripts/kendo/2021.3.1207/kendo.aspnetmvc.min.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/styles/site.css"));

            bundles.Add(new StyleBundle("~/Content/kendocss").Include(
                      "~/Content/kendo/2021.3.1207/kendo.default-v2.min.css"));

            bundles.Add(new StyleBundle("~/Content/dashboardcss").Include(
                "~/Content/styles/dashboard.css"));

            bundles.Add(new StyleBundle("~/Content/backlogcss").Include(
                "~/Content/styles/backlog.css"));

            bundles.Add(new StyleBundle("~/Content/detailcss").Include(
                "~/Content/styles/detail.css"));
        }

 

Here is the head tag in my _Layout.cshtml:


<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RPS Project Tracker</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/Content/kendocss")
    @Scripts.Render("~/bundles/modernizr")
    @RenderSection("styles", required: false)
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")

    @Scripts.Render("~/bundles/kendojs")

    @Html.Kendo().DeferredScripts()
    @RenderSection("scripts", required: false)
</head>

Here's some examples of the errors in my UI:

in /Backlog/{id}/Details view, my DropDownListFor has no styling attributes:

 

On the Dashboard and Backlog pages, my buttons have broken styling:

Inside DevTools, I'm getting the following error:

 

Any help sorting this out is greatly appreciated.

 

 

Eyup
Telerik team
 answered on 29 Dec 2021
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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
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
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?