Telerik Forums
UI for ASP.NET MVC Forum
1 answer
140 views
Let' suppose that I have a model called Person:

public class Person
{
    public string Name {get; set; }
    public List<string> Hobbies {get; set;}
}

I would like to create a View using an item Person as a Model, and editing it.
I cannot find examples on how to tie a grid to the list of hobbies, and on how to update the model back to the server with an HttpPost. Obviously the user should be able to add, modify and delete hobbies in the grid...
Thanks
Daniel
Telerik team
 answered on 06 Jun 2013
2 answers
152 views
Hello There,

I want to use nested ClientDetailTemplateId in Kendo MVC Grid as used in example 
http://demos.kendoui.com/web/grid/detailtemplate.html

But I am getting error in client side ( browser )

Is it possible nesting of detailtemplate or not if yes than how ?

Thanks & Regards
Parmod
Software Engineer
Parmod
Top achievements
Rank 1
 answered on 06 Jun 2013
5 answers
532 views
I'm having the same issue as described in this forum post.  I have a foreign key column in my grid.  In the ClientTemplate() for this column, I'm showing a different property of the ViewModel.  That works as expected.  When I drag the column into the groupables area, it works correctly, however it shows the foriegn key property being grouped on, not the property I'm showing in the ClientTemplate() for the column.

I've messed around with the ClientGroupHeaderTemplate(), but the property from my ViewModel is unavailable and will throw a javascript reference error if I try to use it.  It appears that the only object available to the ClientGroupHeaderTemplate() is the group json object returned from the server.

I have attached a redacted picture of a grid currently in use that demonstrates this.  I'm sure I'm missing something obvious, but can someone point me in the right direction?
Mohit
Top achievements
Rank 1
 answered on 05 Jun 2013
1 answer
148 views
I got no message validation in red Under the field when I have a dropdownlist in my Grid (batch mode).  Only a popup from JavaScript (see attachement)...  Any idea?

p.s.: if i remove the dropdownlist (columns.ForeignKey...) for columns.Bound(p => p.NoFormation); the message display correctly (see second attachement).

My model :
[Required(ErrorMessageResourceName = "ValeurRequise", ErrorMessageResourceType = typeof(GlobalesResources))]
public int NoFormation { get; set; }
Razor :
    @(Html.Kendo().Grid<MesFormations.Models.Employe>()
    .Name("Grid")
    .Columns(columns =>
    {
        columns.ForeignKey(p => p.NoFormation, (System.Collections.IEnumerable)ViewBag.Formations, "Numero", "Description").Title(@MesFormations.Views.Employe.Resources.Titre).Width(240);
        columns.Bound(p => p.DateFormation).Width(90).Format("{0:yyyy-MM-dd}").HtmlAttributes(new { style = "text-align:center" });
        columns.Bound(p => p.Remarques).Width(230);
        columns.Command(command => command.Destroy()).Width(110);
    })
    .ToolBar(toolbar =>
    {
        toolbar.Create();
        toolbar.Save();
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Pageable()
    .Sortable()
    .Scrollable()
    .Resizable(resizing => resizing.Columns(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Events(events => events.Error("error_handler"))
        .Events(events => events.Change("onEdit"))    
        .Model(model => model.Id(p => p.NoFormationEmploye))          
        .Create("Editing_Create", "Employe", new { NoEmploye = Model.NoEmploye })
        .Read("Editing_Read", "Employe", new { NoEmploye = Model.NoEmploye })
        .Update("Editing_Update", "Employe")
        .Destroy("Editing_Destroy", "Employe")
    )
)


Petur Subev
Telerik team
 answered on 05 Jun 2013
2 answers
397 views
Hi all,

I have been browsing the forums and stack overflow and can't find a solution to this.

I implemented the generic Kendo "error" js method as shown in the demos in order to show errors on updates, and then I added the error to my modelstate.

When the grid tries to update and an error is thrown - it automatically retries up to 4 time. Is there a way to prevent this retry from happening?

I am using MVC4 - and a standard MVC controller.

Here is my controller error handler:

catch (Exception ex)
            {
                ModelState.AddModelError("Error", ex.Message);               
                return Json(ModelState.ToDataSourceResult(), JsonRequestBehavior.AllowGet);
            }


Here is the js code for showing the error:

function error(e) {
    if (e.errors) {
        var message = "Errors:\n";
        $.each(e.errors, function (key, value) {
            if ('errors' in value) {
                $.each(value.errors, function () {
                    message += this + "\n";
                });
            }
        });
 
        alert(message);
    }
}


The grid uses a standard Async update method in order to perform the update, and this goes to an MVC controller and not an API controller.

My question again: When the grid tries to update and an error is thrown - it automatically retries up to 4 time. Is there a way to prevent this retry from happening?
Quentin
Top achievements
Rank 1
 answered on 05 Jun 2013
1 answer
133 views
Hi,

I am using the image browser to upload relatively small images (ie 500k) to the filesystem. I have a process whereby the file is uploaded, the MVC controller saves this image to a particular place with a particular name (a GUID). It then returns the JSON result with the new name of the image. This process works perfectly on a local development machine. However, when I deployed this to our test environment, the image was uploaded, but the thumbnail stayed on the swirling ajax loading image.

I've since found that by debugging on my development machine (and therefore slowing down the process) that the ThumbnailUrl gets called before the image has finished uploading. It also gets called with the original name of the file, which is obviously no good for me, as I have changed the name of the file during saving. When this process happens in quicker succession on my local machine, everything gets called at the right time, with the right parameters.

Is there anyway to delay the call to the thumbnailurl call to ensure the upload has completed? Currently I'm having to close the image browser window and reopen so that it loads the thumbnails correctly.

Thanks
Rosen
Telerik team
 answered on 05 Jun 2013
1 answer
238 views
I'm really new at KendoUI.  Just learning it in fact.

I just got this exception (see title) and I really don't know what it means, or why I can't do it.
I'm using an MVC 4 framework in VS 2012

So... some questions.
I know what virtual scrolling is, What is Server binding?
How do I know if I'm doing Server binding?
Is there a way to work around this?Thanks
Robert
Atanas Korchev
Telerik team
 answered on 05 Jun 2013
2 answers
339 views
I need to reset to the first page after sorting the grid. I was trying to use the change event like i was doing when changing page which works perfectly here is my example on how I keep track of my paging.
   var pageable = false;
          if (self.Pageable == true)
              pageable = {
                  refresh: false,
                  pageSizes: self.PageSizes,
                  change: function(e) {
                      if (typeof (Storage) !== "undefined") {
                          localStorage.setItem(self.PageStorageVariable, self.Grid().dataSource.page());
                      }
                  }
              };

and then apply pageable variable to my grid definition
   var g = {
              scrollable: false,
              pageable : pageable ,
              ...
  }

Every time I change a page it gets stored in my local storage and then I do some stuff with it.

I need the same functionality for sorting but only on the on change event:

  var sortable = false;
          if (self.Sortable == true)
              sortable = {
                  mode: "single",
                  allowUnsort: true,
                  change: function (e) {
                      console.log('here');
                  }
              };

          var g = {
              scrollable: false,
              pageable : pageable ,
              sortable : sortable,
             ...
         };

But in this case every time I apply a new sort its not firing my on change function, any ideas on how can I intercept the onSort event so I can reset to page 1 when sorting?
Tim Eck
Top achievements
Rank 1
 answered on 04 Jun 2013
0 answers
89 views
I'm really new at KendoUI.  Just learning it in fact.

I just got this exception (see title) and I really don't know what it means, or why I can't do it.
I'm using an MVC 4 framework in VS 2012

So... some questions.
  1. I know what virtual scrolling is, What is Server binding?
  2. How do I know if I'm doing Server binding?
  3. Is there a way to work around this?
Thanks
Robert
Robert
Top achievements
Rank 1
 asked on 04 Jun 2013
8 answers
639 views
Hello,i did the example with listview editing and it's ok.But if i have also a foreign key to category for example,how cand i use a dropdown list filled with the categories,in that template that appear when i press edit button?
in razor if possible.

Thanks in advance
Daniel
Telerik team
 answered on 04 Jun 2013
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
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
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?