Telerik Forums
UI for ASP.NET MVC Forum
1 answer
2.3K+ views

I have a checkbox in a grid that I want to conditionally disable. What I have below technically hides the checkbox (haven't figured out how to conditionally 'disable') but you can still click in the box and the checkbox will appear even if it does not meet the condition:

@(Html.Kendo().Grid<SomeUI.Areas.UVL.Models.SomePOModel> ().Name("SomePOgrid") .Columns(columns => { columns.Bound(p => p.forceClose).Title("Force Close") .ClientTemplate("#if(status == 'Pending'){# <input id='forceClose' value='#=forceClose#' class='k-checkbox' type='checkbox' checked='checked'/> #}#") .Width(170).HtmlAttributes(new { style = "text-align:center;" });

})

Wondering if you have a better or solution or if someone can explain what I am missing. Thanks.
Ivan Danchev
Telerik team
 answered on 09 Aug 2021
0 answers
137 views

Hello,

I am using Kendo for Asp.Net MVC.  With an ImageBrowser on the Editor control, the name returned from the server (which is different from the file name uploaded) is respected, but for the FileBrowser, the returned name is ignored.  How does on get this to work?

    

<PackageReferenceInclude="Telerik.UI.for.AspNet.Core"Version="2021.2.616"/>

 

   
  @(Html.Kendo().Editor()
    .Name(Model.Id)
    .HtmlAttributes(new { style = "height:470px"aria_label = "editor" })
    .Tools(tools => tools
      .Clear()
      .Bold().Italic().Underline().Strikethrough().JustifyLeft().JustifyCenter()
      .JustifyRight().JustifyFull().InsertUnorderedList().InsertOrderedList().Outdent().Indent()
      .CreateLink().Unlink().InsertImage()
      .InsertFile()//.SubScript()//.SuperScript()//.TableEditing()
      .ViewHtml().Formatting().CleanFormatting()
      )
    .ImageBrowser(
      imageBrowser => imageBrowser
        .Transport(transport =>
        {
          transport.Read(r => r.Url($"/api/imageupload/read?franchiseId={Model.FranchiseId}"));
          transport.Create(c => c.Url("/api/imageupload/create"));
          transport.Destroy(d => d.Url("/api/imageupload/destroy"));
          transport.UploadUrl($"/api/imageupload/uploadurl?franchiseId={Model.FranchiseId}");
          transport.ImageUrl("/api/imageupload/imageurl?file={0}");
          transport.ThumbnailUrl("/api/imageupload/thumbnailurl");
        }
        )
        .Schema(schema => schema.Model(
            model => model.Fields(fields => fields
                .Name(name => name.Field("Name"))
                .Size(size => size.Field("Size"))
                .Type(type => type.Field("EntryType"))
                )
            )
        )
    )
    .FileBrowser(
      fileBrowser => fileBrowser
        .Transport(transport =>
        {
          transport.Read(r => r.Url($"/api/docupload/read?franchiseId={Model.FranchiseId}"));
          transport.Create(c => c.Url("/api/docupload/create"));
          transport.Destroy(d => d.Url("/api/docupload/destroy"));
          transport.UploadUrl($"/api/docupload/uploadurl?franchiseId={Model.FranchiseId}");
        }
        )
        .Schema(schema => schema.Model(
            model => model.Fields(fields => fields
                .Name(name => name.Field("Name"))
                .Size(size => size.Field("Size"))
                .Type(type => type.Field("EntryType"))
                )
            )
        )
    )
    .Value(Model.Value)
  )
Burton
Top achievements
Rank 1
 updated question on 09 Aug 2021
0 answers
284 views

I have aKendo Grid, I have added custom validation on multiple columns. It's working as expected for all the columns, though it's not working for the columns of the type checkbox. It shows the error message even if the checkbox is unchecked.


columns.Bound(config => config.X).Title("X").HeaderHtmlAttributes(new { @class = "grid-headercustom" }).
ClientTemplate("#if(data.X == 1)" + "{#<span>Y</span>#}" + "else{#<span>N</span>#}#").
HtmlAttributes(new { @class = "grid-rowcustom" }).HtmlAttributes(new { style = "font-size:12px" }).Filterable(ftb => ftb.Enabled(false));


$.extend(true, kendo.ui.validator, {
    rules: {
        RateV: function (input, params) {
            if (input.is("[name='X']")) {
                var grid = $("#grid-pricefeedconfiguration").data("kendoGrid");
                var row = input.closest("tr");
                var dataItem = grid.dataItem(row);
                if (dataItem.X == true && dataItem.Y <= 0) {
                    input.attr("data-RateV-msg", "X must be greater than zero when the Y is ticked");
                    return false;
                }
            }
            
            return true;
            }
        },
        messages: {
            RateV: function (input) {
                // return the message text
                return input.attr("data-val-X");
            }
        }
    });
})(jQuery, kendo);

Vivek
Top achievements
Rank 1
Iron
 asked on 07 Aug 2021
0 answers
478 views

Hello everyone,

We have a Kendo Grid for user registration with an input field for first name, last name, etc..  We've encountered a problem with our users whose last name is "Null".  When we attempt to add a new record to the grid, using a kendo popup editor, and enter null in the last name field it will automatically clear it. We are then able to retype it and the value will be retained in the input box while we continue editing. However, after the record is saved the kendo grid will once again clear the field.

Is there anyway we can work around this issue? Thanks for reading.

Colin
Top achievements
Rank 1
 asked on 06 Aug 2021
1 answer
175 views

Good day guys,

I have a problem where i have grid with popup custom window editor. in the pop window I have a MultiColumnComboBox which i can use to update the field which is bound to the MultiColumnComboBox field in the popup window. now the problem comes when some of the fields return the ID and not the string text field which is very weird. have a look at the attached screenshots.

I have the multicomlumncombobox configures as below in the custom popup window 


                        @(Html.Kendo().MultiColumnComboBox()
                                      .Name("NameAbbreviation")
                                      .DataTextField("NameAbbreviation")
                                      .DataValueField("AccoutID")
                                      .ValuePrimitive(true)
                                      .AutoBind(false)
                                      .Filter("contains")
                                      .Placeholder("--Search/Select Mine---")
                                      .FilterFields(new string[] { "AccountType", "Status", "NameAbbreviation", "Company", "Minerals" })
                                      .Columns(columns =>
                                      {
                                          columns.Add().Field("AccountType").Title("AccountType").Width("130px");
                                          columns.Add().Field("Status").Title("Type").Width("130px");
                                          columns.Add().Field("NameAbbreviation").Title("Manufacturer").Width("350px");
                                          columns.Add().Field("Company").Title("Company").Width("350px");
                                          columns.Add().Field("Minerals").Title("Minerals").Width("130px");

                                      })

                                      .Events(e => e.Select("onParkarBayComboSelect"))
                                      .HtmlAttributes(new { style = "width:100%" })
                                      .Height(204)
                                      .FooterTemplate("Total <strong>\\#: instance.dataSource.total() \\#</strong> items found")
                                      .DataSource(source => {
                                          source.Custom()
                                              .ServerPaging(true)
                                              .PageSize(80)
                                              .Type("aspnetmvc-ajax") //Set this type if you want to use DataSourceRequest and ToDataSourceResult instances
                                              .Transport(transport => transport
                                              .Read(read =>
                                              {
                                                  read.Action("ParkerBay_GetMineDetails_Read", "SiteCodes");
                                              }))
                                              .Schema(schema =>
                                              {
                                                  schema.Data("Data") //define the [data](https://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.data) option
                                                        .Total("Total"); //define the [total](https://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.total) option
                                              });
                                      }).ToClientTemplate()

    )

Tony
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 06 Aug 2021
1 answer
178 views

Hi,

We have an issue with timing that we do not want to fix with a timeout. We are doing our best to get things fast, so a timeout is not a option. On the other hand we don't know how to fix it without a timeout.

We have 2 API calls. One to get the columns and one to get the grid. The columns are user defined and stored in a database.

Initial the standard header is loaded. Then the columns are hided by the hideColumn() method. Then the data is loaded.

We will then have the following issue:

We hope we can solve the issue with you.

Roel

 

Eyup
Telerik team
 answered on 06 Aug 2021
1 answer
359 views

I want to update a cell value (column Score) when the user selects another column value from the dropdownlist (column RatingLevel) in a grid.   Column Score is not editable

 

    @(Html.Kendo().Grid<NERDS.ViewModels.SPEEOYRatingEntryViewModel>()
                                .Name("grdRatingElementsList")
                                .Selectable(s => s.Mode(GridSelectionMode.Single))
                                .Columns(columns =>
                                {
                                    columns.Bound(c => c.RatingElementName).Title("Element")
                                                                           .HtmlAttributes(new { @Style = "font-weight: bold" });
                                    columns.Bound(c => c.CriticalOrNonCritical).Title("Critical / Non-Critical").Width(90);
                                    columns.Bound(c => c.Weightage).Title("Weightage (%)").Width(90);
                        //columns.Bound(c => c.R).Title("FY");
                        //columns.Bound(c => c.RatingLevelId).Title("Rating Level").ClientTemplate("#=RatingLevelId# #=RatingLevelName#");
                        columns.Bound(c => c.RatingLevel.RatingLevelName).EditorTemplateName("RatingLevelEditor").Title("Rating Level")
                                                                         .HtmlAttributes(new { @Style = "color: indigo" })
                                                                         .ClientTemplate("#=templateCell(data)#").Width(175);
                        //columns.Bound(c => c.RatingLevelId).Title("Rating Level").ClientTemplate("#=RatingLevelName#");
                        columns.Bound(c => c.Score).Title("Element Score").Width(90)
                                                   .HtmlAttributes(new { @Style = "font-weight: bold" });
                                })
                                //.AutoBind(true)
                                //.Resizable(resize => resize.Columns(true))
                                .Editable(editable => editable.Mode(GridEditMode.InCell))
                                .DataSource(dataSource => dataSource
                                .Ajax()                                
                                .Events(e => e.Change("onLevelChange"))
                                .Model(model =>
                                {
                                    model.Id(f => f.RatingElementName);
                                    model.Field(f => f.RatingElementName).Editable(false);
                                    model.Field(f => f.CriticalOrNonCritical).Editable(false);
                                    model.Field(f => f.Weightage).Editable(false);
                        //model.Field(f => f.RatingLevelId).DefaultValue();
                        model.Field(f => f.Score).Editable(false);

                                })
                                .Read(read => read.Action("GetRatingElements", "SPEEOYRatingEntry"))

                                )
    )

Here is the function where I am trying to set...

    function onLevelChange(e) {
        gridObject = $("#grdRatingElementsList").data("kendoGrid");
        var selectedItems = $.map(gridObject.select(), function (item) {
            return $(item);
        });

        var dataItems = gridObject.dataItems();

        selectedItems.forEach(function (selectedItem) {
            dataItems[selectedItem.index()].Score = 50;  This works if I make the column Score editable but that's not an option!
        });

    }

 

Please need help!

 

Tsvetomir
Telerik team
 answered on 06 Aug 2021
0 answers
73 views

in Gantt-

shivaraj
Top achievements
Rank 1
 updated question on 05 Aug 2021
1 answer
399 views

I'm using a Kendo MVC grid with columns defined as follows:

columns.Bound(p => p.PoolId).Title("Pool").Hidden(true);

columns.Bound(p => p.Client).Title("Client").HtmlAttributes(new { @style = "min-width:120px;" })
    .ClientGroupFooterTemplate("<div class=aright>#:value# Totals:</div>");

With a group on the "PoolId" field:

...

.Group(group => group.Add(g => g.PoolId))

...

Excel export works when I don't reference any Kendo values in the ClientGroupFooterTemplate (or don't include the footer template at all) but just silently fails (doesn't generate a file) when I try to reference any Kendo value using '#='

For example, the following works:

columns.Bound(p => p.Client).Title("Client").HtmlAttributes(new { @style = "min-width:120px;" })
    .ClientGroupFooterTemplate("<div class=aright>Totals:</div>");

but the following is another example of a footer that fails:

columns.Bound(p => p.Client).Title("Client").HtmlAttributes(new { @style = "min-width:120px;" })
    .ClientGroupFooterTemplate("<div class=aright>#= kendo.format('{0:C}', aggregates.PoolContributions.min) #</div>");

How do I get the Excel export working with ClientGroupFooterTemplate?

I'm using Kendo UI MVC version 2021.2.511.545

NOTE: PDF exports work properly

ALSO NOTE: I see the following error in the console

Uncaught ReferenceError: value is not defined
    at Object.eval [as groupFooterTemplate] (eval at compile (kendo.all.js:234), <anonymous>:3:82)
    at kendo.all.js:15113
    at Array.map (<anonymous>)
    at init._footer (kendo.all.js:15107)
    at init._dataRow (kendo.all.js:14952)
    at init._dataRows (kendo.all.js:15005)
    at init._rows (kendo.all.js:15245)
    at init.workbook (kendo.all.js:14865)
    at init.<anonymous> (kendo.all.js:15382)
    at Object.d (jquery.min.js:2)
Ivan Danchev
Telerik team
 answered on 05 Aug 2021
1 answer
160 views

Scenario - I'm Yasen Petrov and I have to create groups of Bulgarian football players (with a variable number of players). The number of players is huge, so I have to use server filtering. I already have the name of the groups, but no player has been assigned to them. I have to be able to add the players, move them up or down in the list, remove them if needed.

Each player has a Guid and a Name. Some examples:

{d912f311-5c6a-450b-886e-8b4effbd6828, Dimitar Berbatov}
{ec621b1e-3a13-4a8c-bcad-78eddae91752, Borislav Mihaylov}
{440eefce-c4c3-44d5-9320-f07fa84d5997, Krasimir Balakov}

When pressing Save, the list of Guids must be sent to the server.

I think a batch editing grid with a GridEditMode.PopUp mode should do the trick. It will have a single column (Name).

I use this DropDownList in another view:

@(Html.Kendo().DropDownListFor( m => m.PlayerId ).MinLength( 3).EnforceMinLength(true).Delay(500).OptionLabel( "Search by player name" )
                                   .DataTextField( "Name").DataValueField( "Id" ).Filter( FilterType.Contains).AutoBind(false)
                                   .DataSource(source => {
                                      source.Read(read =>
                                      {
                                         read.Action( "SearchPlayer", "PlayerGroups" ).Data( "additionalData" ).Type( HttpVerbs.Post);
                                      }).ServerFiltering(true);
                                   }))


How would I go about doing this? I looked for examples of EditorTemplateName, but I haven't been able to find something useful for my case.

Could anyone provide some guidance? Thank you!

   
Anton Mironov
Telerik team
 answered on 04 Aug 2021
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
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
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?