Telerik Forums
UI for ASP.NET MVC Forum
1 answer
118 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
190 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
103 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
129 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
1 answer
122 views
hello everyone

can u tell me please if their is a way (or another MVC extension) to group by columns on grid

and get statics for each group ?
- how much rows
- average for each group

i saw the Grid / Aggregates extension
but it seems like the group are constant (i want dynamic grouping like in the basic grid)

i have attach a picture that explain where i want to see summery 

thank u very much
Petur Subev
Telerik team
 answered on 03 Sep 2014
1 answer
125 views
hello

can u please tell me i can populate grid columns only with certain conditions 

something like this 

   columns.Bound(c => c.ID).Title(ViewBag.SearchBy+" id").HtmlAttributes(new { @class = "search_by_id" });
            columns.Bound(c => c.Clicks);
if(1>0)
{
            columns.Bound(c => c.Conversions).Title("Conversions");
            columns.Bound(c => c.ConversionRate).Title("Conversion rate").Format("{0:p1}"); ;
}

thank u
Dimiter Madjarov
Telerik team
 answered on 03 Sep 2014
1 answer
257 views
hello everyone

can u please tell me if i can populate grid columns only with certain conditions 

something like this 

   columns.Bound(c => c.ID).Title(ViewBag.SearchBy+" id").HtmlAttributes(new { @class = "search_by_id" });
            columns.Bound(c => c.Clicks);
if(1>0)
{
            columns.Bound(c => c.Conversions).Title("Conversions");
            columns.Bound(c => c.ConversionRate).Title("Conversion rate").Format("{0:p1}"); ;
}

thank u
Dimiter Madjarov
Telerik team
 answered on 03 Sep 2014
4 answers
184 views
I am not sure how to get the values from the sortable object on the post call.  Does the Viewmodel property have to match the <li> name or I the sortible object name 



               @(Html.Kendo().Sortable()
                        .For("#StandardsDirectives")
                        .ConnectWith("#MyStandardsDirectives")
                        .PlaceholderHandler("placeholder")
                        .Cursor("url('" + Url.Content("~/Content/Curser/closedhand.cur") + "'), default")
                    )

OR

                                       @if (!Equals(Model.Document, null))
                                        {
                                            foreach (var standard in Model.Document.MyStandardsDirectives)
                                            {
                                                <li class="list-item">@Html.Label(standard.Name)</li>
                                            }
                                        }
steve
Top achievements
Rank 1
 answered on 02 Sep 2014
1 answer
99 views
Hi,
I'm working on dynamic grid loaded with bounded column based on datatable definition passed in model, and grid is populated by JSON with dynamic Linq. I have a problem with setting the filtering. Sorting and grouping works just fine, but I don't know why for int type I get list which suggests it's a string. Then when filter for example the main Id with IsEqual I get an error: An exception of type 'System.ArgumentException' occurred in System.Core.dll but was not handled in user code. Then I get right results, but icon is showing that it's still searching. What could be tha cause, and how can I fix it? 
Daniel
Telerik team
 answered on 02 Sep 2014
1 answer
193 views
How do you get the scheduler to display a validation message in red next to the control that has the error?  I'm getting an alert with the errors to display per an example but that doesn't look very professional.  See attached image. 
Alexander Popov
Telerik team
 answered on 01 Sep 2014
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
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
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?