Telerik Forums
UI for ASP.NET MVC Forum
1 answer
127 views
I have a grid that has multiple DropDownLists.   All of the DropDownLists are populated using the ViewData object.    In this case, I have a DropDownList that I would actually like it to populate multiple other columns in the Grid.    I am not sure how I can access the other information in the ViewData object.   So the Project_Key and the NameDesc columns in the model are for the dropdown.   But, the other columns Mgt_Unit_Key, Program_Key and Zone_Key are columns in the ViewData that I want to use to populate (default) other columns in the grid to.    How can I access these other columns in the ViewData and assign them to columns in the grid?

Here is the basics of my controller:
    public ActionResult TimecardIndex()
        {
            ViewData["Projects"] = this.projectservice.GetDropDownList();
            return View();
        }

The grid looks like:
@(Html.Kendo().Grid<IRISWeb.Models.CAS.Timecard>()
    .Name("Grid")
    .Columns(c =>
    {
        c.Command(command => { command.Destroy(); }).Width(120).Lockable(true).Locked(true);
        c.Bound(p => p.Task_Date).Width(120).Lockable(true).Locked(true).EditorTemplateName("IRISDate");
        c.ForeignKey(p => p.Activity_Key, (System.Collections.IEnumerable)ViewData["Activities"], "Activity_Key", "NameDesc").Width(350).Lockable(true);
        
        c.ForeignKey(p => p.Project_Key, (System.Collections.IEnumerable)ViewData["Projects"], "Project_Key", "NameDesc").Width(350);
        c.ForeignKey(p => p.ProjectSub_Key, (System.Collections.IEnumerable)ViewData["ProjectSubs"], "ProjectSub_Key", "NameDesc").EditorTemplateName("ProjectSub").Width(200);
        
        c.ForeignKey(p => p.Mgt_Unit_Key, (System.Collections.IEnumerable)ViewData["Mgt_Units"], "Mgt_Unit_Key", "NameDesc").Width(350);
        c.ForeignKey(p => p.Program_Key, (System.Collections.IEnumerable)ViewData["Programs"], "Program_Key", "NameDesc").Width(350);
        c.ForeignKey(p => p.Zone_Key, (System.Collections.IEnumerable)ViewData["Zones"], "Zone_Key", "NameDesc").Width(350);
        c.ForeignKey(p => p.Road_Key, (System.Collections.IEnumerable)ViewData["Roads"], "Road_Key", "FullRoadNumber").Width(200);
.....

The model for the ProjectDropDown returned by the GetDropDownList() is:
 public class ProjectDropDown
    {
        [Key]
        [ScaffoldColumn(false)]
        public string Project_Key { get; set; }

        [MaxLength(70)]
        [Display(Name = "Name")]
        public string NameDesc { get; set; }

        [MaxLength(10)]
        [Display(Name = "Mgt. Unit")]
        public string Mgt_Unit_Key { get; set; }

        [MaxLength(10)]
        [Display(Name = "Program")]
        public string Program_Key { get; set; }

        [MaxLength(10)]
        [Display(Name = "Zone")]
        public string Zone_Key { get; set; }

        [MaxLength(10)]
        [Display(Name = "Road")]
        public string Road_Key { get; set; }
    }





























































Alexander Popov
Telerik team
 answered on 05 Sep 2014
1 answer
93 views
Hi,

We are trying to use Jquery UI tabs within an MVC page that has a Kendo UI Grid, but the css
for the Jquery UI tab is not loading in IE8, we removed the grid and added the tabs alone that seems to be working
is there a conflict between Jquery UI and Kendo UI. Is there a work around for this issue

Thanks,
Annie
Vladimir Iliev
Telerik team
 answered on 05 Sep 2014
1 answer
171 views
Hello,

I'm trying to setup a panelbar that uses anglularjs library in their dynamically loaded panels. Unfortunately I was not able to make my angularjs controllers and ng attributes working in the loaded panels. The code below:

Index.cshtml
..

@(Html.Kendo().PanelBar()
    .Name("panelbar")
    .ExpandMode(PanelBarExpandMode.Single)
    .Items(panelbar =>
    {
        panelbar.Add().Text("About")
            .LoadContentFrom("About", "Home"); // About - Action, Home - controller
 
        panelbar.Add().Text("Contact")
            .LoadContentFrom("Contact", "Home");
    })
)


About.cshtml
<script src="~/Scripts/Controllers/AboutController.js"></script>
<div ng-controller="AboutController">
    {{ "this one is not working..." }}
</div>

AboutController.js
(function () {
    var app = angular.module("testPanel");
    var AboutController = function() {
        console.log('not working as it supposed to work ');
    }
    app.controller("AboutController", AboutController);
}());

The Anglular controllers and attributes are working fine outside the PanelBar. 
Thanks!
Alex Gyoshev
Telerik team
 answered on 05 Sep 2014
1 answer
198 views
Hello,

I'm trying to add some client side validation to the WYSIWIG Editor in MVC, however I cannot find any forum posts or docs with instructions on how to do this. I've tried basic unobtrusive validation but that obviously doesn't work because the textarea generated by KendoUI is set to hidden.

Can you please point me in the right direction on how to do this? I'd only like to do simple client side validation such as "Not Empty" etc.
Daniel
Telerik team
 answered on 05 Sep 2014
2 answers
299 views

Hi,

I am using kendo ui asp.net mvc.I have kendo grid with Virtualization support. Virtualization will load data on scroll. When grid has multiple pages at that time I can’t find records of previous page through JavaScript or Jquery and also I loss the state of previous record.

Is kendo ui providing progressive data load support in grid control?

In our application, we want to load data with progressive load like Silverlight.

For ex:

Case 1:

I have 500 total records and grid page size is 20.So I will get 20 records in each page. When I scroll for more record previous record must maintain in same state. If I select any record through checkbox and move down and again come bake top previous record must get with select state.

 Case 2:

 I have 500 total records and grid page size is 20.So I will get 20 records in each page. My filtering, sorting and search will perform on server or backend service side. In first page I select top 5 records out of 20.now I search diff record which is not available in first 20 records so I have to take that from service but when I back must found previous record with new record in select state.

How can I handle this type of situation without progressive load?        


digiben
Top achievements
Rank 1
 answered on 04 Sep 2014
3 answers
379 views
Hy,
I am using the CssClass and able to display one icon..on the treenode.

Using Style like so
.Item { background-position: 0 -272px; }

Now how can I show two Icons on the same Node ?

I see an example Image on the web here : http://www.telerik.com/clientsfiles/386203_Untitled.png?sfvrsn=0

Can anyone help ?

Thanks
sv
Rick Nguyen
Top achievements
Rank 1
 answered on 04 Sep 2014
1 answer
102 views
I have a grid where the first time I select an item from a DropDownList and tab out of the cell, the cell show dirty (red mark) but the cell blanks and does not show the selected item.   If I tab back into the cell and select an item from the DropDownList a second time, then the cell remembers the selection.   This happens on all DropDownList on the grid.    The following is my grid code:

@(Html.Kendo().Grid<IRISWeb.Models.CAS.Timecard>()
    .Name("Grid")
    .Columns(c =>
    {
        c.Command(command => { command.Destroy(); }).Width(120).Lockable(true).Locked(true);
        c.Bound(p => p.Task_Date).Width(120).Lockable(true).Locked(true).EditorTemplateName("IRISDate");
        c.ForeignKey(p => p.Activity_Key, (System.Collections.IEnumerable)ViewData["Activities"], "Activity_Key", "NameDesc").Width(350).Lockable(true);
        
        c.ForeignKey(p => p.Project_Key, (System.Collections.IEnumerable)ViewData["Projects"], "Project_Key", "NameDesc").Width(350);
        c.ForeignKey(p => p.ProjectSub_Key, (System.Collections.IEnumerable)ViewData["ProjectSubs"], "ProjectSub_Key", "NameDesc").EditorTemplateName("ProjectSub").Width(200);
        
        c.Bound(p => p.Crew_Num).Width(120);
        c.ForeignKey(p => p.Employee_Key, (System.Collections.IEnumerable)ViewData["Employees"], "Employee_Key", "EmployeeNumFullName").Width(350);
        c.Bound(p => p.Labor_Quantity).HtmlAttributes(new { style = "text-align: right" }).Width(120);
        c.ForeignKey(p => p.Pay_Type_Key, (System.Collections.IEnumerable)ViewData["Pay_Types"], "Pay_Type_Key", "NameDesc").Width(150);
        c.ForeignKey(p => p.Premium_Key, (System.Collections.IEnumerable)ViewData["Premiums"], "Premium_Key", "NameDesc").Width(150);
        c.Bound(p => p.Override_Labor_Rate).Format("{0:c}").HtmlAttributes(new { style = "text-align: right" }).Width(200);
        c.Bound(p => p.Production).HtmlAttributes(new { style = "text-align: right" }).Width(130);
        c.Bound(p => p.Equipment_Quantity).HtmlAttributes(new { style = "text-align: right" }).Width(150);
        c.ForeignKey(p => p.Equipment_Key, (System.Collections.IEnumerable)ViewData["Equipments"], "Equipment_Key", "NameDesc").Width(350);
        c.Bound(p => p.Equipment_Unit_Cost).Format("{0:c}").HtmlAttributes(new { style = "text-align: right" }).Width(120);
        c.Bound(p => p.Material_Quantity).HtmlAttributes(new { style = "text-align: right" }).Title("Mat. Qty").Width(120);
        c.ForeignKey(p => p.Inventory_Location_Key, (System.Collections.IEnumerable)ViewData["Inventory_Locations"], "Inventory_Location_Key", "NameDesc").Width(350);
        c.ForeignKey(p => p.UOM_Key, (System.Collections.IEnumerable)ViewData["UOMs"], "UOM_Key", "NameDesc").Width(100);
        c.Bound(p => p.Material_Description).Title("Mat. Description").Width(120);
        c.Bound(p => p.Material_Unit_Cost).Format("{0:c}").HtmlAttributes(new { style = "text-align: right" }).Title("Mat. Unit Cost").Width(150);
        c.ForeignKey(p => p.Resource_Item_Key, (System.Collections.IEnumerable)ViewData["Resource_Items"], "Resource_Item_Key", "Name").Width(350);
        c.Bound(p => p.OutSideServiceDescription).Width(120);
        c.Bound(p => p.OutSideService_Quantity).HtmlAttributes(new { style = "text-align: right" }).Width(100);
        c.Bound(p => p.OutSideServiceCost).Format("{0:c}").HtmlAttributes(new { style = "text-align: right" }).Width(120);
        c.ForeignKey(p => p.Mgt_Unit_Key, (System.Collections.IEnumerable)ViewData["Mgt_Units"], "Mgt_Unit_Key", "NameDesc").Width(350);
        c.ForeignKey(p => p.Program_Key, (System.Collections.IEnumerable)ViewData["Programs"], "Program_Key", "NameDesc").Width(350);
        c.ForeignKey(p => p.Zone_Key, (System.Collections.IEnumerable)ViewData["Zones"], "Zone_Key", "NameDesc").Width(350);
        c.ForeignKey(p => p.RBF_Key, (System.Collections.IEnumerable)ViewData["RBFs"], "RBF_Key", "NameDesc").Width(200);
        c.ForeignKey(p => p.Road_Key, (System.Collections.IEnumerable)ViewData["Roads"], "Road_Key", "FullRoadNumber").Width(200);
        c.ForeignKey(p => p.RoadName_Key, (System.Collections.IEnumerable)ViewData["RoadNames"], "RoadName_Key", "NameDesc").Width(200);
        c.Bound(p => p.Beg_Point).Width(120);
        c.Bound(p => p.End_Point).Width(120);
        c.Bound(p => p.FromLocation).Width(180);
        c.Bound(p => p.ToLocation).Width(180);
        c.ForeignKey(p => p.Reason_Key, (System.Collections.IEnumerable)ViewData["Reasons"], "Reason_Key", "NameDesc").Width(200);
        c.Bound(p => p.Comments).Width(280);
        c.Bound(p => p.EquipmentMiles).HtmlAttributes(new { style = "text-align: right" }).Width(100);
        c.Bound(p => p.EquipmentHours).HtmlAttributes(new { style = "text-align: right" }).Width(100);
        c.Bound(p => p.User1).Width(120);
        c.Bound(p => p.User2).Width(120);
        c.Bound(p => p.User3).Width(120);
        c.Bound(p => p.User4).Width(120);
        c.Bound(p => p.User5).Width(120);
        c.Bound(p => p.User6).Width(120);
        c.Bound(p => p.User7).Width(120);
        c.Bound(p => p.User8).Width(120);
        c.Bound(p => p.User9).Width(120);
        c.Bound(p => p.User10).Width(120);
        c.Bound(p => p.FuelImport).HtmlAttributes(new { style = "text-align: center" }).ClientTemplate("<input type='checkbox' #=FuelImport ? checked='checked' : '' #></input>").Width(200);
        c.Bound(p => p.Error_Message).Width(220);
        c.Bound(p => p.DateStamp).Title("Last Modified").Format("{0: MM/d/yyyy hh:mm:ss}").Width(175);
        c.ForeignKey(p => p.SecurityUser_Key, (System.Collections.IEnumerable)ViewData["SecurityUsers"], "SecurityUser_Key", "UserName").Title("IRIS User").Width(140);
    })
    .ToolBar(toolBar =>
    {
        toolBar.Create();
        toolBar.Save();
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Filterable()
    .Pageable(pageable => pageable
        .Refresh(true)
        .PageSizes(true)
        .ButtonCount(5))
    .Navigatable()
    .Sortable()
    .Scrollable(a => a.Height("auto"))
    .Resizable(resize => resize.Columns(true))
    .Reorderable(reorder => reorder.Columns(true))
    .ColumnMenu(m =>
    {
        m.Enabled(true);
        m.Filterable(true);
        m.Sortable(true);
        m.Columns(true);
    })
    .DataSource(ds => ds
        .Ajax()
        .Batch(true)
        .ServerOperation(true)
        .PageSize(20)
        .Events(e => 
        {
            e.Error("error_handler");
            //e.Change("onChange");
        })
        .Sort(s => s.Add(t => t.Task_Date))
        .Model(model =>
        {
            model.Id(m => m.Timecard_Key);
            model.Field(m => m.Equipment_Unit_Cost).Editable(false);
            model.Field(m => m.UOM_Key).Editable(false);
            model.Field(m => m.FuelImport).Editable(false);
            model.Field(m => m.DateStamp).Editable(false);
            model.Field(m => m.SecurityUser_Key).Editable(false);
            model.Field(m => m.SecurityUser_Key).DefaultValue(ViewData["defaultSecurityUser"]);
            model.Field(m => m.Timecard_Key).DefaultValue("1600000000");
            model.Field(m => m.DateStamp).DefaultValue(DateTime.Now);
        })
        .Read(r => r.Action("Read", "Timecard").Type(HttpVerbs.Get))
        .Create(c => c.Action("Create", "Timecard").Type(HttpVerbs.Post))
        .Update(u => u.Action("Update", "Timecard").Type(HttpVerbs.Post))
        .Destroy(d => d.Action("Destroy", "Timecard").Type(HttpVerbs.Post))

    )

)

<script>
    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);
        }
    }

    function onChange(e) {
        if (e.action == "itemchange") {
                switch (e.field) {
                    case "Project_Key":
                        var model = e.items[0];
                        model.set("ProjectSub_Key", "");
                        break;
                    case "Inventory_Location_Key": 
                        var model = e.items[0];
                        model.set("UOM_Key", "");
                        break;
                };
        }
     
    }

 
    function filterProjectSubs() {
        var model = getCurrentEditedModel();
        return {
            Project_Key:model.Project_Key
        };
    }

    function filterInventoryUOM() {
        var model = getCurrentEditedModel();
        return {
            Inventory_Location_Key: model.Inventory_Location_Key
        };
    }

    function getCurrentEditedModel() {
        var grid = $("#Grid").data("kendoGrid");
        var editRow = grid.tbody.find("tr:has(.k-edit-cell)");
        return grid.dataItem(editRow);
    }


</script>
Kiril Nikolov
Telerik team
 answered on 04 Sep 2014
3 answers
172 views
Hi,

In a Telerik kendo hierarchical grid for asp.net mvc is it possible to update both parent and child tables with a single save button on the parent grid

Thanks,
Annie
Alexander Popov
Telerik team
 answered on 04 Sep 2014
6 answers
78 views
How do I get more information in the displayed event?  Currently it only displays the title (see attached image).  I looked at this: http://demos.telerik.com/aspnet-mvc/scheduler/templates (this is the example that has an IMDB link on it using the following code.) but it can't be doubled clicked to edit the event.

.EventTemplate(
    "<div class='movie-template'>" +
        "<img src='" + Url.Content("~/Content/web/scheduler/") + "#= Image #' />" +
        "<p>" +
            "#= kendo.toString(start, 'hh:mm') # - #= kendo.toString(end, 'hh:mm') #" +
        "</p>" +
        "<h3>#= title #</h3>" +
        "<a href='#= Imdb #'>Movie in IMDB</a>" +
    "</div>")

I'd like to do something like this but be able to double click it and change it.
Edward
Top achievements
Rank 1
 answered on 04 Sep 2014
1 answer
107 views
Hi there,

I've read in places that the grid will automatically use Kendo Validators inside the add / edit popup, even if this is a custom form - is there any way to prevent this behaviour, so that it will just use standard MVC validation controls?

For complicated reasons, the decision has been made not use Kendo Validators inside our current MVC application - meaning that the validators on our normal forms look very different at present from those used on the grid popups.

If this behaviour can't be prevented, can the Kendo Validators be easily styled to look the same as the default MVC controls - at the minute, all we would like is a simple line of text to appear beside the control.

Thanks,

Paul
Daniel
Telerik team
 answered on 04 Sep 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?