Telerik Forums
UI for ASP.NET MVC Forum
5 answers
986 views

I've got a situation where I want to return data from the controller if there are errors on the file i'm uploading.

 

For simple messages, i can just do [return Content("error")] which will cause the uploader to show an error message (with relevant error items - red colour, X icon etc).

 

However, i have a case where i am returning a JSON object with details of all the issues with the uploaded file like so [return Json(returnItem)].

 

I would expect the upload control to fail (as the documentation states it only accepts an empty string to be the success case) but i am getting the success behaviour from the upload control (green text).

 

How can i make it so it shows the error state when i am returning a JSON object?

 

 

Thanks

 

 

Dimiter Madjarov
Telerik team
 answered on 07 Oct 2016
1 answer
145 views

Hello,

Is it possible to dynamically toggle the enabled status of multiple ComboBox widgets at once using a Jquery class selector and iterating the results?  If this is possible, what is the proper way to accomplish this behavior?  My form has multiple ComboBoxes which need to by dynamically enabled or disabled based on user selections.

 

Using UI for MVC (Q3 2016)

My current attempt at this behavior is as follows:

         @(Html.Kendo().ComboBoxFor(Model => Model.InsertStockWeightOption)
          .Placeholder("Select Weight Or Specify")
          .HtmlAttributes(new { style = "width:100%;", @class = "ComboBoxDisableOnStartup", id="TestCombo" })
          .DataSource(source => source.Read("GetStockWeightsForType", "ProjectQuote", new { Type = "Insert" })))

JS Code to disable on document creation:

        $(document).ready(function () {
            $(".ComboBoxDisableOnStartup").each(function (i, box) {  //This code does not function clearly, this is only to convey the attempt to toggle using classes
                var obj = box.data("kendoComboBox");
                obj.enable(false);
            });
            var combobox = $("#TestCombo").data("kendoComboBox");  //This code is from the documentation and works for a single ComboBox with an ID
            combobox.enable(false);
        });

Peter Milchev
Telerik team
 answered on 06 Oct 2016
4 answers
1.8K+ views
I have a UI where I am allowing the filtering of date by DateTime range. I have followed the example in the Kendo UI Demo to ensure that the range is enforced. What I am attempting to do is add a "Reset" button to this UI that will reset the values of the DateTimePicker's to the default range. I have researched and read multiple articles/posts, and I am still unable to resolve my issue. I can't seem to pinpoint why this is happening, but most of the time, the value of the DateTimePicker after calling .value() is null.

Here is my code:

 
function resetDateTimePickersToDefaultDateTimeRange() {
 
    var currentDate = new Date(),
        yesterdayDate = new Date(),
        dateTimeFormat = 'MM/dd/yyyy hh:mm tt';
 
    yesterdayDate.setDate(yesterdayDate.getDate() - 1);
 
    var $startDateTimePicker = $('#StartDateTimePicker').data('kendoDateTimePicker');
    var $endDateTimePicker = $('#EndDateTimePicker').data('kendoDateTimePicker');
 
    $endDateTimePicker.value(kendo.toString(currentDate, dateTimeFormat));
    $endDateTimePicker.trigger('change');
 
    $startDateTimePicker.value(kendo.toString(yesterdayDate, dateTimeFormat));
 
    $startDateTimePicker.trigger('change');
 
}


And just for completeness, here are the change events I have wired up for each of the DateTimePicker's:

function kendoStartDateTimePickerChange() {
    var endPicker = $('#EndDateTimePicker').data('kendoDateTimePicker'),
        startDate = $('#StartDateTimePicker').data('kendoDateTimePicker').value();
 
    if (startDate) {
        startDate = new Date(startDate);
        startDate.setDate(startDate.getDate() + 1);
        endPicker.min(startDate);
    }
}
 
function kendoEndDateTimePickerChange() {
    var startPicker = $('#StartDateTimePicker').data('kendoDateTimePicker'),
        endDate = $('#EndDateTimePicker').data('kendoDateTimePicker').value();
 
    if (endDate) {
        endDate = new Date(endDate);
        endDate.setDate(endDate.getDate() - 1);
        startPicker.max(endDate);
 
        if (endDate < startPicker.value()) {
            startPicker.value(endDate);
        }
    }
}

And here is where I am calling the reset() function:

$('#ResetFilterButton').click(function () {
    $('#FilterByInput').val('');
    resetDateTimePickersToDefaultDateTimeRange();
 
    populateGrid($('#StartDateTimePicker').val(), $('#EndDateTimePicker').val(), $('#FilterByInput').val());
});

Angel Petrov
Telerik team
 answered on 06 Oct 2016
1 answer
92 views

Hi, I have seen that you have a "theme builder" tool.

It allows customize an existing theme and download it.

I already have customized and downloaded a thema but now I want to make a small modification.

¿I can import / upload my theme to the "theme builder" tool and make a modification?
or
¿I have to re-use an original thema and redo all changes over the original theme?

Rumen
Telerik team
 answered on 05 Oct 2016
4 answers
371 views

Hello,

I load the following via ajax and the shown  javascript Alert fires proving jquery and javascript are working.  Editor Events work but I need to clear the editor contents programmatically.   At the console, well after all loaded and completed, $("#editor") is undefined.  I am looking at this documentation.  http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/editor/overview#existing-instances

 

 <div id="editorWrapper">
            @(Html.Kendo().Editor()
            .Name("editor")
            .HtmlAttributes(new { @class = "desc-editor", name = "Description", id = "Description" })
            .Resizable(resizable => resizable.Content(true).Toolbar(true))
            .StyleSheets(css => css
            .Add(Url.Content("~/Content/editorStyles.css"))
            )
            .Tools(tools => tools
            .Clear()
            .Bold().Italic().Underline().Strikethrough()
            ).Events(events => events
            .Change("change")
            .Execute("execute")
            .Select("select")
            .Paste("paste")
            ).Value(@<text> </text>)
            )

            <script>
            $(function () {
                alert($(".input-field").length);

                //Notice that the Name() of the Editor is used to get its client-side instance.
                var editor = $("#editor").data("kendoEditor");
            });
            </script>

        </div>

John
Top achievements
Rank 1
 answered on 05 Oct 2016
2 answers
282 views

I was working on the grid persistence with getOptions and setOptions. I believe I was able to get it to work successfully, but I noticed something on one of filters. 

 

My grid has a dropdown selection, like in the 'Grid / Filter menu customization' demo. After the setOptions is called, the filter dropdown is blank.

 

We use the asp.net mvc version, but I was able to reproduce this error in the browser using the javascript console on both the asp.net mvc and the kendo ui versions of the 'Grid / Filter menu customization' demo (which has a filter dropdown on the City column).

 

In my above test of the 'Grid / Filter menu customization' demo, I saw the City filter dropdown go blank after setOptions is called. You are no longer able to select from a dropdown of cities.

 

Any input would be appreciated!

 

 

Marv
Top achievements
Rank 1
 answered on 05 Oct 2016
9 answers
177 views


.Pageable(pager => pager.Enabled(true).PreviousNext(true).PageSizes(new Int32[] {10, 20, 50, 100}))

I just downloaded the latest version of the js files and the Kendo.Mvc.dll

If I remove PageSizes I don't get an error. Any clues?

==========================================================================================

Also, when I add .DataSource binding paging stops working entirely

        @(Html.Kendo().Grid(Model.AppointmentList).Name("FailedAppointments")
                .Columns(columns =>
                {
                    columns.Bound(o => o.MemberFirstName).Title("Member First").Width(70);
                    columns.Bound(o => o.MemberLastName).Title("Member Last").Width(80);
                    columns.Bound(o => o.ClientMemberID).Title("Client ID").Width(60);
                    columns.Bound(o => o.ProviderID).Title("Provider ID").Width(60);
                    columns.Bound(o => o.ProviderFirstName).Title("Provider First").Width(70);
                    columns.Bound(o => o.ProviderLastName).Title("Provider Last").Width(100);
                    columns.Bound(o => o.AppointmentDate).Title("Appointment Date").Width(200);
                    columns.Bound(o => o.IHAAppointmentID).Hidden(true);
                })
                .Pageable(page => page.Enabled(true))
                .DataSource(source => source.Ajax().Read(read => read.Action("BindFailedAppointments""AppointmentScheduling")))                                                    
               
This is the result:



If I remove the DataSource binding, paging shows but does nothing. What is going on?
Dimiter Madjarov
Telerik team
 answered on 05 Oct 2016
1 answer
1.0K+ views

We have AutoComplete working in MVC with this in the view:

@(Html.Kendo().AutoComplete()
.Name("ContentTagsAddt")
.DataTextField("TagName")
.HtmlAttributes(new { style = "width:700px" })
.Placeholder("Begin Typeing Additional Tags...")
.MinLength(3)
.Filter("startswith")
.Separator(", ")
.Value(Model.AdditionalContentTags)
.DataSource(source => source
    .Custom()
    .Group(g => g.Add("TagGroup", typeof(string)))
    .Type("aspnetmvc-ajax")
    .ServerFiltering(true)
    .ServerPaging(true)
    .PageSize(20)
    .Transport(transport => transport
        .Read("GetContentTag", "Article")
    )
    .Schema(schema =>
    {
        schema.Data("Data")
            .Total("Total");
    })
)
)

And it's datasource looks like:

public JsonResult GetContentTag([DataSourceRequest] DataSourceRequest request)
{
    var tags = oandpService.GetContentTags();
 
    return Json(tags.ToDataSourceResult(request));
}

The table it's using to populate is pretty small (37 rows). We'd really like to have the ability to show all items on focus. Would that be possible? An added bonus is if the AutoComplete stays open the entire time and as the person types it highlights the suggestions.

Veselin Tsvetanov
Telerik team
 answered on 05 Oct 2016
1 answer
383 views

I'm trying to bind a MultiSelect to a list of strings. How do I write an data-binding expression for DataTextField and DataValueField?

@model List<string>

@Html.Kendo().MultiSelect().BindTo(Model).DataTextField("?").DataValueField("?")

Nikita
Top achievements
Rank 2
Iron
Iron
 answered on 03 Oct 2016
1 answer
253 views

I have a Spreadsheet which already Bind to an object (see below code). I want to open a file (import) and Bind it with my existing binding.

@(Html.Kendo().Spreadsheet()
.Name("spreadsheet")
.Sheetsbar(false)
.Toolbar(x => x.Data(false).Insert(false))
.HtmlAttributes(new { style = "width:100%;" })
.Rows(5000)
.Events(e => e.ExcelImport("ImportProduct"))
.Sheets(sheets =>
{
sheets.Add()
.Name("Product")
.DataSource<MyCompany.DTO.Logistics.Planning.ProductSearchResultDTO>(ds => ds
.Ajax()
.Batch(true)
.Read(r => r.Action("ProductBulkSearchResults", "Logistics").Data("getCriteria"))
.Update(u => u.Action("ProductBulkUpdate", "Logistics").Data("getCriteria"))
.Events(e => e.Change("onChange"))
.Model(m =>
{
m.Id(p => new { p.ProductID, p.ORGID });
})
)
.Columns(columns =>
{
columns.Add().Width(100);
columns.Add().Width(415);
columns.Add().Width(0);
columns.Add().Width(0);
columns.Add().Width(145);
})
;
})
)

Ivan Danchev
Telerik team
 answered on 03 Oct 2016
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
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?