Telerik Forums
UI for ASP.NET MVC Forum
4 answers
1.8K+ views

Hello to all.

I have a scheduler with a Custom Editor.

A model with the member Image (string)

I'd like to use an Upload control in order to

1) upload the image on the server, by sending also the calendarID in case of editing an existing calendar event

2) on Save, store the file name in the Image member of the model.

At the moment I'm able to insert an Upload control in the custom Editor, but I'm not able to store the filename in the Model member (via MVVM)

Is this possible?

Should I use the "save event" of the calendar to discover the current value of the Upload control and update the model (how is possible to update the model ???)

 Thanks.

 My code:

 member of the Model:

[Display(Name = "Logo")]
public string Image { get; set; }

 

Custom Editor:

(NB: calendarID should be the ID of the current calendar in case of editing, but I don't know how :-( )

Thanks!!!

 

<div class="k-edit-label">
    @(Html.LabelFor(model => model.Image))
</div>
<div data-container-for="Image" class="k-edit-field">
    @(Html.Kendo().Upload()
        .HtmlAttributes(new { accept = "image/*" })
        .Name("calendarImages")
        .Async(async => async
            .Save("SaveImage", "Calendar", new { calendarID = 1 })
            .Remove("RemoveImage", "Calendar", new { calendarID = 1 })
            .AutoUpload(true)
        )
        .Multiple(false)
    )
</div>

Veselin Tsvetanov
Telerik team
 answered on 12 Sep 2018
3 answers
2.6K+ views

I'd like to create a grid based on a ViewModel type like you normally would:

                    @(Html.Kendo().Grid<BlockoutPeriodVM>()
                        .Name("BlockoutWeeks")
                        .Columns(columns =>
                        {
                            columns.Bound(b => b.Name).Title("Name");
                            columns.Bound(b => b.StartDate).Title("Start Date").Format("{0:d}");
                            columns.Bound(b => b.EndDate).Title("End Date").Format("{0:d}");
                            columns.Template(@<text>[buttons]</text>).Title("Edit").ClientTemplate(@"#= crm.setup_classSchedule_edit.getBlockoutCommandTemplate(data) #");
                        })
)

 

but I want to manage the data that it is bound to myself, on the client-side. In my script, I will deserialize an array of BlockoutPeriodVMs and would then like to set that array as the datasource of the grid. I will also offer CRUD support for this array outside of the grid so I'm hoping the Grid/datasource can make the array an observable array and update according to any changes I make. I found this old thread asking the same thing for jQuery Kendo UI, but is there a way to set the read action to a function like that using the MVC Html helper?

Jesse
Top achievements
Rank 1
Veteran
 answered on 12 Sep 2018
2 answers
907 views

I try to use drag and drop/select from file folder to upload multiple files.  It does not act the way as your demo does.  It can not select multiple files.  It can not drag and drop.  The drag and drop region does not show.   

Here is the code in the Upload.cshtml page:

@using (Html.BeginForm(null, null, FormMethod.Post, new { enctype = "multipart/form-data", id = "form" }))
{
 <div class="form-input">
  <div>
   The Upload can be used as a drop-in replacement
   for file input elements.
  </div>
  <div>
   @(Html.Kendo().Upload()
   .Name("attchments")
   .Async(a => a
    .Save("Upload", "Home")
    .Remove("RemoveUpload", "Home")
    .AutoUpload(true))                
   ))
  </div>
  <p style="padding-top: 1em; text-align: right">
   <button type="submit" class="k-button k-primary">Submit</button>
  </p>
 </div>
}

In _Layout.cshtml page, I have the following links:

<link href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" />
<link href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2018.1.221/kendo.default.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2018.1.221/kendo.common.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2018.1.221/kendo.default.mobile.min.css")" rel="stylesheet" type="text/css" />
<link href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.dataviz.default.min.css" rel="stylesheet" type="text/css" />
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/kendo.all.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/kendo.aspnetmvc.min.js"></script>
<script src="@Url.Content("~/Scripts/kendo/2018.1.221/jszip.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>

 

What do I missed?  

Thanks in advance for your help!

Anieda

 

Anieda Hom
Top achievements
Rank 1
 answered on 11 Sep 2018
1 answer
302 views

Hi,

 

I'm using the MVC TreeList with remote data loading.I have the latest column to be a checkbox, but I have an issue when the node is expanded. After expanded, all of the nodes below in the same tier get unchecked, even if they were checked before that. Here is a video of the problem.

https://www.screencast.com/t/zt234VFtdLEO

Am I doing something wrong?

This is the code for the tree list:

        @(Html.Kendo().TreeList<TreeEntity<Organization>>()
                                                                                                .Name("treelist")
                                                                                                .Columns(columns =>
                                                                                                {
                                                                                                    columns.Add().Field(e => e.Value.Id).Width(280).Title("ORG ID");
                                                                                                    columns.Add().Field(e => e.Value.Name).Width(280).Title("ORGANIZATION NAME");
                                                                                                    columns.Add().Field(e => e.Value.ActiveFlag).Width(60).Title("ACTIVE");
                                                                                                    columns.Add().Width(60).Title("SELECT").TemplateId("cbx-template");
                                                                                                })
                                                                                        .DataSource(dataSource => dataSource
                                                                                            .Read(read => read.Action("OrganizationsTree_Read", "Home"))
                                                                                            .Model(m =>
                                                                                            {
                                                                                                m.Id(f => f.Id);
                                                                                                m.ParentId(f => f.ParentId).DefaultValue(null);
                                                                                                m.Field(f => f.Value.Id);
                                                                                                m.Field(f => f.Value.ParentId);
                                                                                            })
                                                                                            )
                                                                                            .Events(events => { events.DataBound("onTreeDataBound"); events.Expand("onTreeExpand"); })
                                                                                .Height(540)
        )

 

DataBound and Expand are JS methods without any code except console.log(arg).

 

Thank you

Konstantin Dikov
Telerik team
 answered on 11 Sep 2018
2 answers
266 views

Hello,

I am trying to add (css: border-color:red) to MaskedTextBox when field is required on submit function but I couldn't find this class. What is name of this class?

Also, I need to remove this class if the customer click on Save button that can skip validations.

Thank you for help.

Elena
Top achievements
Rank 1
 answered on 10 Sep 2018
16 answers
1.5K+ views

Hi there, I am just trying to install the MVC 5 version from the private nuget feed. Everytime I try to install it, it freezes Visual Studio, any of them. I've tried in 2012, 2013, and 2015. Same thing always happens. When I check the project, the package installs the Scripts and the fonts folder, no editor templates or content.

The output says Installing Telerik.UI.xxx.MVC5xxx, adding package Telerik.UI.MVC5. Added package Telerik.UI.MVC5, and that's where it freezes.

I cannot use the telerik template creators because I want to add kendo UI to my existing projects. Nuget package is the best way. I tried downloading the nuget package too and installing it that way, still same freeze. What is going on? Thanks.

Marin Bratanov
Telerik team
 answered on 10 Sep 2018
1 answer
95 views

Here is my Razor grid markup...

 

@(Html.Kendo().Grid<Karpos.WebUI.Models.HolidayDinnerModel>(Model) //Bind the grid to ViewBag.Products
                    .Name("grid")
                    .Columns(columns =>
                    {
                        columns.Bound(model => model.PLU).Groupable(true);
                        columns.Bound(model => model.Name);
                    })
                    .Pageable() //Enable the paging.
                    .Sortable() //Enable the sorting.
                    .Groupable()

)

 

The grid loads with data correctly but when I try to drag the PLU column to the Head to group on PLU, it is greyed out. All columns are the same way.

 

Any help?

Scott
Top achievements
Rank 1
 answered on 07 Sep 2018
1 answer
126 views
     I have been trying a number of different ways to batch edit child rows and click one save button to then save those changes locally and update the associated master rows.  I am not using Ajax, ServerOperation is set to false on both grids.  My problem is that upon setting the master row cells, the main grid is refreshed, collapsing all my child rows, losing their edits and ultimately only the first row changes are saved.  Any advice on how to stop this refresh from happening until my loop is complete?
Viktor Tachev
Telerik team
 answered on 07 Sep 2018
1 answer
152 views
Hi, Is there any possibility to export to PDF for gantt timeline view and contents view separately? Reply asap.
Nencho
Telerik team
 answered on 07 Sep 2018
2 answers
243 views

HI, I work on a project that uses Kendo MVC widget. I install it from the Telerik Nuget Source and add: Telerik.UI.for.AspNet.Mcv5 Version 2018.2.704. All work great until I need to use ForeignKey column in my grid. The drop-down list does not appear. I look on Google and someone says that I need to add the EditroTemplates views under Views/Shared in my MVC project. So I took the one in your demo at this location C:\Program Files (x86)\Progress\Telerik UI for ASP.NET MVC R2 2018\wrappers\aspnetmvc\Examples\VS2017\Kendo.Mvc.Examples\Views\Shared

But Now I got this runtime error: cannot load  'System.Web.Mvc.ViewUserControl<object>'. in

Line 1 : <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<object>" %>
Line 2 :
Line 3 : <%= Html.Kendo().TextBoxFor(model => model)%>

Source file : /Views/Shared/EditorTemplates/String.ascx    Line : 1 

What do I missed?

Pierre
Top achievements
Rank 2
Iron
Iron
 answered on 06 Sep 2018
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
DropDownButton
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
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
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?