Telerik Forums
UI for ASP.NET MVC Forum
3 answers
699 views
Been looking hard for answers to this but haven't been successful. These are the conditions:
  • MVC 4
  • Kendo MVC 2013,1,319,340
  • Grid using Ajax Binding
  • Using Web Api
I'm binding the grid to a model with a structure that looks something like this:

Organization
- Id
- Name
- Address
---- Id
---- Street
---- Zip
---- City

Most works fine (Creating (POST), Deleting (DELETE), Get (get)). However, when trying to update (PUT), the Address is not properly bound in the controller. I've attached a screenshot from fiddler showing the request body. Looks kinda weird to me.

I've also attached two screens showing the invalid ModelState and the error.

So, my question is if it's possible to properly bind the whole object (Organization) including the Address? I quess my model could be flattened but if possible I'd like to avoid that to keep it cleaner.

Vladimir Iliev
Telerik team
 answered on 03 Apr 2013
5 answers
181 views
Hello,
i have a strange error when i am using the grid in batch mode.
even if i have all the values in the grid fields when i press the save changes button,it appears a message box with some required validation errors.I put some validations on the viewModel
something like this
[Required(ErrorMessageResourceType = typeof(Payroll.Resources.Resources),ErrorMessageResourceName = "ValidationMessage_Required")]
public string Name { get; set; }

indeed i put that javascript code
<script type="text/javascript">

function error_handler(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);
}
}
</script>
but the validations should active only if i do not have anything in the grid fields.

Why it appears those messages?what could be the error?

Regards,
Daniel
Daniel
Top achievements
Rank 1
 answered on 03 Apr 2013
1 answer
115 views
Hello,

I'm having a problem with an editor template that I have inside the grid.  I'm using an inline edit grid with keyboard navigation turned on.  The editor template has 3 Kendo Numeric Textboxes in it, so when the user goes into the grid cell they will see all three textboxes.  They are supposed to be able to type in those three inputs and then move on to the next cell to be edited.  I've run into a couple of problems with this and was hoping to get some help as to the best way to handle this type of input.

1)  My first issue was that the tabbed navigation did not work inside the cell.  Initially focus goes to the first input control, which is as desired.  But then if the user hits the tab key the focus goes to the next cell in the grid.  The behavior I was hoping for was that focus would go to the next control in the cell.  I was able to solve this issue by binding to the "keydown" event on the input controls and manually handling the tab key press and setting focus to the next control.  But I'm wondering if there is a better way to handle this or if this is something that the control should handle out of the box?

2)  The second issue is a little more problematic because I haven't been able to figure out a workaround.  I'm using the grid Save event to run some custom logic to handle saving these multiple values back to my model.  With the keydown code that I implemented above, the Save event fires after tabbing out of the first two textboxes.  But when tabbing out of the last textbox the Save event does not fire.  The difference with the last textbox is that I'm not overriding the keydown code anymore and just letting the grid navigate to the next cell.  But shouldn't the Save event still fire in this case?

Let me know if my description makes sense or if I can provide any additional detail.  If it would be helpful I can try to use the demo source code to create an example of my situation.

Thanks for your help!

Regards,
Brian
Brian Roth
Top achievements
Rank 1
 answered on 02 Apr 2013
2 answers
627 views
Hey peeps,

I am a bit stuck on this problem.
I have a ton of maintenance CRUD views that I am implementing in my project. I use convention to ensure I am consistent with naming of repo's, views, editors, etc... and using this to simplify the building of my grids with editor templates etc...
I have created an HtmlHelper extension that returns a GridBuilder<T> so that I can keep the building of the grids for my CRUD views uniform and consistent - and give me a single place to make changes if necessary.
All my grids will show a CreatedOn column and a Commands column with Edit and Destroy buttons. I cannot figure out a way to get these columns to ALWAYS be at the END of the column list. All works hundreds with the creation of the grid but these 2 columns are always FIRST in the list and I don't want them to be.

Here is a simple example.
First the extension I have created. Note the 2 columns created here which will display in all views that use this grid.
public static class HtmlHelperExtensions
    {
        public static GridBuilder<T> SavitarCRUDGrid<T>(this HtmlHelper helper, string name)
            where T : class, IEntity
        {
            string entityType = typeof(T).ToString();
            int index = entityType.LastIndexOf('.');
            entityType = entityType.Substring(index + 1, entityType.Length - (index + 1));
             
            return helper.Kendo().Grid<T>()
                        .Name(name)
                        .Groupable()
                        .Pageable()
                        .Sortable()
                        .Scrollable()
                        .Filterable()
                        .Pageable()
                        .Selectable(e => e.Mode(GridSelectionMode.Single))                                                 
                        .ToolBar(toolbar => toolbar.Create())                          
                        .Columns(columns =>
                        {
                            columns.Bound(p => p.CreatedOn).Width(100).Format("{0:dd/MM/yyyy}");
                            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(170);
                        })                       
                        .Editable(editor => editor
                            .Mode(GridEditMode.PopUp)
                            .Window(window => window
                                .Name("EditorWindow")                               
                                .Title("Smartrail Editor")
                                .Visible(false)
                                .Modal(true)
                                .Width(475)
                                 
                                .Render()
                            )
                            .TemplateName(entityType + "Editor")                              
                        )
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(20)
                            .Model(model => model.Id(p => p.ObjectId))
                            .Events(events => events.Error("onError"))
                            .Create(x => x.Action("Editor_Create", entityType))
                            .Read(x => x.Action("Editor_Read", entityType))
                            .Update(x => x.Action("Editor_Update", entityType))
                            .Destroy(x => x.Action("Editor_Destroy", entityType))
                            .ServerOperation(false));        
        }
    }

And here is the usage in my EditorTemplate.
@(Html.SavitarCRUDGrid<ReefType>("Grid1")
        .BindTo(Model)
        .Columns(columns =>
                       {
                           columns.Bound(p => p.Description);
                       })
    )

This works perfectly, except the order of the columns in the grid is
Created On, Commands, Description
I am trying to get CreatedOn and Commands to the end so my grid renders as
Description, Created On, Commands.

Any ideas?

TIA
Mike
DominionZA
Top achievements
Rank 1
 answered on 02 Apr 2013
2 answers
147 views
Are there any VB examples available for Treeview. I've been trying for hours to get even a simple Treeview populated but I've been getting nowhere.
Nathan
Top achievements
Rank 2
 answered on 02 Apr 2013
6 answers
221 views
I'm trying to set up a sparkline, and I've got it working.

However, the tool tip shows the data field name, as well as the value, unlike your demos, where just the number is shown.
@(Html.Kendo().Sparkline()
.Name("BatchTimeSpark")
.Type(SparklineType.Column)
.DataSource(ds=>ds
    .Read(read => read.Action("GetBatchStats", "Home"))
  )
  .Series(s=>s
      .Column("RunLength")
  )
   
   
  )
I've attached a screenshot of the tool tip.
Also, what's the best way to set the height. My chart seems very short (the values are small, but I expected it to scale).

Thanks
--
AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 02 Apr 2013
1 answer
468 views
Hello!
I use IntegerTextBox
I use this 
@helper RenderConfigPlan()
 
....
<tr class="k-header">
                         <td>@Html.LabelFor(x => x.minProfit)</td>
                         <td>@Html.EditorFor(x => x.minProfit, "Integer")</td>
 </tr>
}
and I see next:
"minProfit" , which located at the top of the page with  IntegerTextBox from Kendo
and another "minProfit", where it should be, but  with IntegerTextBox from Asp

Why is this happening?(because of @RenderConfigPlan())
Petur Subev
Telerik team
 answered on 02 Apr 2013
2 answers
129 views
As per the subject question, I have a tall listview - and the loading icon/animation is not visible due to the height of the listview - so I'd like to be able to move it top center (offset down a bit) in the listview client area when loading.
Rene
Top achievements
Rank 1
 answered on 01 Apr 2013
1 answer
138 views
Hello,

I am learning kendoui for MVC and I am having trouble with a very simple example of Autocomplete. 

Everything seems to work fine apart from one thing:

When I start typing in the autocomplete something that is found in the data behind the autocomplete, the dropdown falls not below the textbox but over the textbox, therefore I cannot see the suggestion or the cursor and it doesn't look right. The CSS have been included correctly. I am attaching a screenshot before typing and after typing in the autocomplete. 

Thanks in advance,

Lefteris 
Dimo
Telerik team
 answered on 01 Apr 2013
1 answer
91 views
Hello,

I am trying to use a ListView to edit a list of generic components inside a form. Currently, I am using ASP.NET MVC standard mechanism to automatically choose a template editor using the current element type. All elements extend the same abstract class (which serves as the base model of the list) but I need to display the specific information of each subclass inside the editor.

I want to use ListView to have the possibility to add and remove elements from the list but I don't know how to make the template use the ASP.NET MVC .EditorFor mechanism.

Thanks in advance
Daniel
Telerik team
 answered on 01 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?