Telerik Forums
UI for ASP.NET MVC Forum
4 answers
396 views
I am having an issue with trying to test out a client template using a tabstrip within a detailview of a grid. The template being passed to Template.compile is:

"<div class="k-widget&#32;k-tabstrip&#32;k-header" id="Inty#=Id#"><ul class="k-reset&#32;k-tabstrip-items"><li class="k-item&#32;k-state-default"><a class="k-link" href="\#Inty#=Id#-1">Turtle</a></li></ul><div class="k-content" id="Inty#=Id#-1">Brownie</div></div><script><br><span class="Apple-tab-span" style="white-space:pre"> </span>jQuery(function(){jQuery("\#Inty#=Id#").kendoTabStrip({});});<br><\/script>"


It appears to be choking on the encoded spaces such as &#32;


My code producing this as follows

cshtml:
<script id="jobGridTemplate" type="text/kendo-tmpl">
@(Html.Kendo().TabStrip().Name("Inty#=Id#").Items( items => items.Add().Text("Turtle").Content(@<text>Brownie</text>) ).ToClientTemplate())
</script>
 
@(
 
    Html.Kendo().Grid<JobGridViewModel>()
        .Name("Grid")
        .ClientDetailTemplateId("jobGridTemplate")
        .Columns(columns =>
                     {
                         columns.Bound(p => p.Id).Hidden();
                         columns.Bound(p => p.Name).Width("15em").ClientTemplate(Html.ActionLink("#=Name#", "Edit", new {selectedjobid = "#=Id#"}).ToHtmlString());
                         columns.Bound(p => p.Number).Width("11em");
                         columns.Bound(p => p.Cost).Width("12em");
                         columns.Bound(p => p.Status).Template(@<text>
                                                                    @item.Status;
                                                                </text>)
                             .ClientTemplate("#= statusValues[Status] #")
                                             .EditorTemplateName("JobStatusEditor").Width("9em");
                         columns.Bound(p => p.Date).Width(130).Format("{0:d}").EditorTemplateName("Date");
                         columns.Bound(p => p.Commissions).Filterable(false).Template(@<text>
                                                                         @ListCommission(item, CommissionType.Sell)
                                                                     </text>).EditorTemplateName("ClientCommission").ClientTemplate("#= template(data.Commissions) #").Sortable(false);
                         columns.Command(command =>
                                             {
                                                 command.Edit();
                                                 command.Destroy();
                                                 command.Custom("Duplicate").Text("Copy").SendDataKeys(true).SendState(true).Click("onGridCommand");
                                             }).Width(280);
 
                     }).ToolBar(y=> y.Template(
                                    @<text>
                                         <div>
                                             Job Name
                                             @(Html.Kendo().AutoComplete().Name("SearchName").DataSource(source =>
                                                                                                             {
                                                                                                                 source.Read(read => read.Action("_GetJobNamesLike", "Jobs"                                                                                                                          })
                                                 .Events(events => events.Change("onFilterChange")))
                                         </div>
                                         <div>
                                             Job Number
                                             @(Html.Kendo().AutoComplete().Name("SearchNumber")
                                                   .DataSource(binding =>
                                                                   {
                                                                       binding.Read(read => read.Action("_GetJobNumbersLike", "Jobs"));
                                                                   }).Events(events => events.Change("onFilterChange")))
                                         </div>
                                         @item.CustomCommandToolBarButton("NewJob", "New Job", "New", "Jobs", null)
                                     </text>))
        .Editable(editable => editable.Mode(GridEditMode.InLine))
 
        .Sortable()
        .Pageable(paging => paging.PageSizes(new int[]{20,40,60,80}))
        .Scrollable(config => config.Height(1000).Virtual(true))
        .Resizable(resize => resize.Columns(true))
        .Filterable()
        .DataSource( dataBinding =>
                        dataBinding.Ajax().Events(e =>
                                                      {
                                                          e.RequestStart("onGridDataBinding"); // try Ajax().Data("sendData") return { foo: "bar" };
                                                      }).Model(model => model.Id(id => id.Id))
                        .Read(read=>read.Action("_SelectAjaxEditing", "Jobs", new {jobName="", jobNumber=""}))
                        .Create(create => create.Action("_InsertAjaxEditing", "Jobs"))
                        .Update(update => update.Action("_SaveAjaxEditing", "Jobs"))
                        .Destroy(destroy=>destroy.Action("_DeleteAjaxEditing", "Jobs")))
                         
                         
        .Events(events =>
                    {
                        events.Change("onGridEdit").DataBound("onRowDataBound")
                              .DetailExpand("onGridExpand")
                              .DetailCollapse("onGridCollapse");
 
                    })
)


I am eager to see this product in action but this small issue would be a show stopper for me for switching over the rest of my code base.

Robert
Top achievements
Rank 1
 answered on 06 Jun 2013
3 answers
191 views
Hi,

I just downloaded the KendoUI for Web trial and using it in a MVC 4 application.

Here are some issues which I am facing.

1) In IE 8 the design of Grid is not displaying properly(Refer the attached Image).

2) I am not able to assign any styles to grid.As mentioned in telerik forum I have linked the following css files in page (kendo.common.min.css,kendo.default.min.css) still the fonts are not changing.Its always get displayed with Times new Roman font.What if I need to display the grid with other fonts like Arial and all.

3) Filter menu in columns are displaying broad and small for different columns.I want the filter menu two display in unique style for all columns and the style should be short display. I dont want the broad display.
Refer image(FilterMenuPblm.jpg)  to get details of broad display and refer image (FilterMenuProperDisplay.jpg) to get an idea of display what I want to be displayed in all columns.

Can you please help me to resolve these issues.
A2H
Top achievements
Rank 1
 answered on 06 Jun 2013
1 answer
125 views
Hi support,

I am getting  "Invalid language tag error"  when i select the time in chrome browser  while using kendo TimepickerFor.  Error image is attached and below is my code.

My model class:
       [RequiredIf("MONDAY", true, ErrorMessage = "Required")]
        public DateTime? MONDAY_FROM_TIME { get; set; }
        [RequiredIf("MONDAY", true, ErrorMessage = "Required")]
        public DateTime? MONDAY_TO_TIME { get; set; }

Partial page:
                   @(Html.Kendo().TimePickerFor(h => h.HIRE_FLEET_AVAILIABILITY.MONDAY_FROM_TIME)
                        .Format("hh:mm tt")
                        .Interval(15)
                        .Enable(Model != null ? Model.HIRE_FLEET_AVAILIABILITY.MONDAY : false)
                        .HtmlAttributes(new { @style = "width:100px" }))
             
                        @(Html.Kendo().TimePickerFor(h => h.HIRE_FLEET_AVAILIABILITY.MONDAY_TO_TIME)
                        .Format("HH:mm")
                        .Interval(15)
                        .Enable(Model != null ? Model.HIRE_FLEET_AVAILIABILITY.MONDAY : false)
                        .HtmlAttributes(new { @style = "width:100px" }))
       
Petur Subev
Telerik team
 answered on 06 Jun 2013
1 answer
155 views
Hello !

Please help me with this. I'm trying to reference an item property in a helper function inside the template. How can I do this ?

<script type="text/x-kendo-tmpl" id="template">
    <div class="process-view">
        <div class="edit-buttons">
            @(Html.ActionLink("Create New", "Process_Create", "Process",
                new { id=${ProcessID} }))
        </div>
        <dl>
            <dt>Code</dt>
            <dd>${ProcessCode}</dd>
            <dt>Name</dt>
            <dd>${Name}</dd>
            <dt>Description</dt>
            <dd>${Description}</dd>
            <dt>ID</dt>
            <dd>${ProcessID}</dd>
        </dl>
    </div>
</script>
The problem is that the compiler tries to solve the item reference and throws a
CS1056: Unexpected character '$'

I've also tried with #:ProcessID#, and get 
CS1040: Preprocessor directives must appear as the first non-whitespace character on a line

What should I do ?

Thanks,

Leandro
Dimo
Telerik team
 answered on 06 Jun 2013
1 answer
115 views
Hello,
I'm testing your library Kendo UI for my application in ASP.NET MVC4.
I placed inside a view a kendo.treeview dynamically loaded as shown in your examples.
Now I have the need, following an update of the data on the database (added a node), to force the loading of the treeview with new data without reloading the view.
There is a client function to do this?
If you could send me an example?


thanks
Alex Gyoshev
Telerik team
 answered on 06 Jun 2013
1 answer
99 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
134 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
461 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
108 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
357 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
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?