Telerik Forums
UI for ASP.NET MVC Forum
17 answers
1.2K+ views
I'm having trouble figuring out how to have a dropdown list within a grid while performing inline editing with data that is unique to each individual row.

We have a grid that has a detail template, and in the detail template is another grid (in reality the child grid is housed within a tab panel but I'm presenting it this way for simplicity sake).  The parent grid is readonly and the child grid contains editable rows.  When adding a row to the child grid (using inline editing) we need one of the columns to display a dropdown containing values that are unique to each parent grid's row ID. 

While searching through the demo's I came across the following:
http://demos.kendoui.com/web/grid/editing-custom.html
However, in our situation we need each row's dropdown to have different values (rather than binding to a single list in the viewbag). 

I was horsing around with creating a column with a ClientTemplate containing a dropdownlist that pulls its data from a controller method, but was unable to figure out the exact syntax to get it to work within the context of a row detail template.  Is this the only way to go about doing this or am I missing something obvious?  Thanks!
Georgi Denchev
Telerik team
 answered on 09 Feb 2021
16 answers
979 views

My model like this

public class MyViewModel
{
   public int Id { get; set; }
 
   [DataType(DataType.Date)]
   public DateTime ApplicationDate { get; set; }
}

 

My View like this

.DataSource(d => d
     .Custom()
     .Type("aspnetmvc-ajax")
     .Batch(true)
     .Schema(s => s
         .Model(m => m.Id(p => p.ProductID));
         .Data("Data");
         .Total("Total");
         .Errors("Errors"))
    .Transport(transport => t
        .Read(r => r.Action("GetData", "Controller", new { IdClient = Model.Client.Id })
        .Submit("onSubmit")))
 

And finally my javascript block

function onSubmit (e) {
   var myData = e.data.created[0];
}

 

And the is the hic! myData like this

{
   Id: 0,
   ApplicationDate: Tue Apr 26 2016 00:00:00 GMT-0400 (heure d’été de l’Est)
}

 

Yes the quotes is missing in the output format. And the model is not valid. I set format on both DataSource.Shema.Model.Field.Format and Column.Bound.Format  to "yyyy-MM-dd" and it still return JSON on incorrect format.

Does it possible to set Kendo to use ISO8601 instead of the JavasCrap Format ?

Nikolay
Telerik team
 answered on 09 Feb 2021
5 answers
264 views

After I ran through the upgrader within Visual Studio 2019 to reference 2021.1.119 components I am all of a sudden seeing spurious <script> blocks rendered as inline html on certain (but not all) components and not on all views where various Kendo MVC components are referenced:

 

kendo.syncReady(function(){jQuery("#FiscalYearDropDown").kendoDropDownList({"change":onFiscalYearChange,"dataSource":{"transport":{"read":{"url":"/AssignedInvoices/GetFiscalYears"},"prefix":""},"schema":{"errors":"Errors"}},"dataTextField":"FiscalYear","dataValueField":"Fis

Misho
Telerik team
 answered on 09 Feb 2021
1 answer
165 views

     I had a dropdownlist in a page populated like so

@(Html.Kendo().DropDownList()
    .Name("domain")
    .DataTextField("DomainName")
    .DataValueField("DomainName")
    .DataSource(dataSource =>
        dataSource.Read(read =>
            read.Action("GetDomainNames", "MinMax"))
    )
)

 

public JsonResult GetDomainNames()
{
    var dictDomains = new Dictionary<string, string>();
 
    using (var inoAutoEntities = new InoAutoEntities(InoAutoEntitiesHelper.GetEntityString(InoAutoEntitiesHelper.GetCredents())))
    {
        var localSettings = inoAutoEntities
            .Settings
            .Where(item => item.Machine == ".")
            .ToDictionary(item => item.Name);
 
        if (localSettings["UseAutomatedControlService"].Value=="True")
        {
            foreach (var domain in inoAutoEntities.CartSideDomains.GroupBy(item => item.Domain).Select(item => item.Key))
            {
                dictDomains.Add(domain, domain);
            }
 
        }
        else
        {
            var carts = inoAutoEntities.CartControls.Where(item => item.TypeControl == (int)ETypeControl.Owner).ToList();
            foreach (var cartControl in carts)
            {
                if (!dictDomains.ContainsKey(cartControl.Domain))
                {
                    dictDomains.Add(cartControl.Domain, cartControl.Domain);
                }
            }
 
        }
    }
 
    var returnList = dictDomains
        .Keys
        .OrderBy(item => item)
        .ToList();
 
    returnList.Insert(0,"All Domains");
    var result = returnList.Select(item => new DomainModel() {DomainName = item}).AsEnumerable();
    return Json(result,JsonRequestBehavior.AllowGet);
}

 

I wanted to move the dropdownlist to a toolbar but i see that the only way to do that is to use javascript to initialize

what is the syntax that would allow me to populate using a datasource that calls the controller action. I could not find information in the

documentation for toolbar or dropdownlist. any help would be appreciated

@(Html.Kendo().ToolBar()
     .Name("ToolBar")
     .Items(items =>
     {
         items.Add().Template("<div><label>Labels:</label><input id='labels' style='width: 150px;' /></div>").OverflowTemplate("<span></span>");
     }
     )
     )

 

<script type="text/javascript">
    $(document).ready(function () {
        $("#labels").kendoDropDownList({
            dataTextField: "DomainName",
            dataValueField: "DomainName"
        });
    });
 
</script>

 

 

 

Ivan Danchev
Telerik team
 answered on 08 Feb 2021
1 answer
179 views

     Hello, I am using dotnet MVC 6 (not core) and I have a need to only allow the KendoUI on some pages but not others. I am using the controls on a form built before we bought KendoUI, some forms were pre-built using the dotnet mvc scaffolding tool. Those forms do not need the KendoUI emitters, which normally would not be a problem except that when I run the project I am getting the following error in chrome:

Uncaught ReferenceError: kendo is not defined

And the following code is included for each control on the page:

kendo.syncReady(function(){jQuery("#First_Name").kendoTextBox({"value":"James"});});

I have tried removing the javascript references and that did not work, the code still gets emitted. I know why it is happening, because the javascript files are loaded at the bottom of the page, way after the above script tries to execute. I can't use deferred as I am not using the Kendo helpers on this page. Is there any other way to do this besides moving the kendo controls to the top of the page? And, if I have to move the controls to the top of the page, can I do that without moving the bootstrap and jquery script calls to the top as well (IE., are the kendo scripts dependent on JQuery or Bootstrap to be initialized first)?

Thanks in advance...

Martin
Telerik team
 answered on 08 Feb 2021
3 answers
575 views

Using FileManager in our app, and we are seeing the following exception when trying to create a "New Folder".   We do not see this error with any other operations, and are able to upload, rename, & delete files/folders without issue.   Is this a binding issue with our resulting json (see below)?  The funny thing is that this exception does not occur every time we click the "New Folder" button.  It shows up maybe 75% of the time. 

 

The exception is:

VM8695:3 Uncaught ReferenceError: extension is not defined
    at eval (eval at compile (kendo.all.js:234), <anonymous>:3:164)
    at init.refresh (kendo.all.js:70463)
    at init.proxy (jquery-3.1.1.js:502)
    at init.trigger (kendo.all.js:164)
    at init._process (kendo.all.js:7940)
    at init._change (kendo.all.js:7889)
    at init.proxy (jquery-3.1.1.js:502)
    at init.trigger (kendo.all.js:164)
    at init.splice (kendo.all.js:5008)
    at init.insert (kendo.all.js:7078)

 

 

Our FileManager datasource is a configured like this...

dataSource: {
    schema: kendo.data.schemas.filemanager,
    transport: {
        read: {
            url: "MyController/GetObjects/",
            method: "POST"
        },
        create: {
            url: "MyController/CreateObject/",
            method: "POST"
        },
        update: {
            url: "MyController/UpdateObject/",
            method: "POST"
        },
        destroy: {
            url: "MyController/DestroyObject/",
            method: "POST"
        },
    },
},

 

 

Our controllers method for CreateObject is:

[HttpPost]
public ActionResult CreateObject(string target)
{
    var result = myService.CreateFolder("NewFolder", target);
    return Json(result, JsonRequestBehavior.AllowGet);
}

 

 

And the json results are:

{
    "SId": "<guid>",
    "ObjectType": "Folder",
    "IsDirectory": true,
    "HasDirectories": false,
    "RootPath": "<some stuff>",
    "NameSpace": "<some stuff>",
    "Path": "myDir\\NewFolder",
    "Name": "NewFolder",
    "Extension": "",
    "Size": 0,
    "PathLocator": "<some stuff>",
    "ParentPathLocator": "<some stuff>",
    "Created": "\/Date(1593736985477)\/",
    "CreatedUtc": "\/Date(-62135571600000)\/",
    "Modified": "\/Date(1593736985477)\/",
    "ModifiedUtc": "\/Date(-62135571600000)\/",
    "Content": null
}

 

 

Thanks for any advice.

 

Doran

Ivan Danchev
Telerik team
 answered on 08 Feb 2021
1 answer
484 views

Hello,

Does the Scheduler support this functionality?:

If the user has made some changes to the event and is closing the window without saving. Is i possible to make a warning saying something like "You have made changes to the event. Do you want to save the changes or close the window?"

//Allan

 

Martin
Telerik team
 answered on 08 Feb 2021
10 answers
1.2K+ views

Hello;

I want to load data using Kendo MVC Grid based on a requirement.

At first I want to load empty grid, then,

I have an html search textbox where I will provide ID, then

based on the ID provided on the search textbox, I want to load data on the grid.

 

Look at the attached pic for more info.

How can I achieve this, if there is a sample code please give me the link.

 

Looking forward for your help.

Thank you

Georgi Denchev
Telerik team
 answered on 05 Feb 2021
6 answers
1.1K+ views

I have an issue in Telerik grid...can you please help me 

 

Here is my Grid code

        @(Html.Telerik().Grid<ClassName>()
              .DataBinding(dataBinding => dataBinding.Ajax().OperationMode(GridOperationMode.Client).Select("GetSearchResult", "Work"))
              .Name("SearchResult")
              .Columns(columns =>
                  {
                      columns.Bound(o => o.TicketId)
                      columns.Bound(o => o.TicketName)

                      columns.Bound(o => o.TicketDescription)

)}

.Scrollable(c => c.Height(3000))
              .Sortable()
              .ClientEvents(events => events.OnComplete("onComplete").OnDataBinding("DataBinding").OnDataBound("SearchResultDataBound").OnRowDataBound("RowDataBound")
              .NoRecordsTemplate("...")
              .Pageable(pager => pager.PageSize(30)

)

 

Like this i have 15 columns in Grid, but my Stored Procedure retuns 40 Columns data, and 500 rows.

when the search data is less than 400 rows from Procedure data is showing in UI, But when the result is more than 400 (max 500 recods from Stored Procedure) records i am getting Internal server error alert popup from telerik.common.min.js   ....

i don't understand why this is happening.

can you please help me.

 

 

tram
Top achievements
Rank 1
Veteran
 answered on 05 Feb 2021
1 answer
618 views
I'm working with the tab control now and need to have a badge attached to one of the tabs. As the user works in the tab, however, the badge content needs to update. I have found references to the JQuery forum for something like this, but am unable to make it work in MVC. What would be the recommended approach for MVC?
Ivan Danchev
Telerik team
 answered on 04 Feb 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
LLM Kit
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?