Telerik Forums
UI for ASP.NET MVC Forum
1 answer
233 views
Has anyone experienced seeing "NaN/NaN/0NaN" in Kendo UI grids for fields prior to 1970?  I'm experiencing this in the Kendo UI grids, but not the previous Telerik UI grids. 
The fields (date of births) are of type "Datetime?"
The view i'm using uses .Format("{0:d}") for formatting, might that be the issue?
 
    columns.Bound(od => od.PatientDOB).Format("{0:d}").Title("PatientDOB").Width(50);

Attached 2 screenshots for visual representation.
I'm wondering if there is a workaround to this issue.

Any help is greatly appreciated.
Thanks!
Drew
Top achievements
Rank 1
 answered on 26 Mar 2014
7 answers
1.6K+ views
Hi guys,

I'm trying to embed a dropdown menu (bootstrap) inside a grid on the first column of each bound row (basically creating a menu for each item). It works but the menu is hidden behind the next row down so there's something to do with the markup of the grid overlapping the markup of the menu.

Here's the markup:

@(Html.Kendo().Grid<Listing>()
        .Name("grid")
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("RefreshTable", "HomeController"))
        )
        .Columns(columns =>
        {
            columns.Bound(x => x.Number)
                .Width(120)
                .Template(@<text></text>)
                .ClientTemplate(
                    "<div class='btn-group'>" +
                    "<button type='button' class='btn btn-default btn-sm dropdown-toggle' data-toggle='dropdown'><span id='selectedTagType'>#= Number#</span> <span class='caret'></span></button>" +
                    "<ul class='dropdown-menu' role='menu'>" +
                    "<li><a onclick='editRecord();'></a>Edit</li>" +
                    "<li><a onclick='activateRecord();'></a>Activate</li>" +
                    "<li><a onclick='transferRecord();'></a>Transfer</li>" +
                    "</ul>" +
                    "</div>"
                );
            columns.Bound(x => x.TypeDescription);
            columns.Bound(x => x.PhoneNumber);
        })
    )
Bil
Top achievements
Rank 1
 answered on 26 Mar 2014
2 answers
174 views
Hello Telerik Team,

While in grid editing mode, is there a way to validate that a DateTime field is not in the past? or be within a specific range?

Thanks!
Alaa Masoud
Top achievements
Rank 1
 answered on 26 Mar 2014
7 answers
626 views
Hello,

I have some trouble to get the data bind of a list in a EditorTemplate for the schelduler.

Here is how i create the schelduler :
@(Html.Kendo().Scheduler<iMail.Web.Models.TaskViewModel>()
    .Name("scheduler")
    .Date(DateTime.Now)
    .StartTime(new DateTime(2013, 6, 13, 7, 00, 00))
    .Height(600)
    .Views(views =>
    {
        views.DayView();
        views.WeekView();
        views.MonthView();
        views.AgendaView(agenda => agenda.Selected(true));
    })
    .Selectable(true)
    .Timezone("Etc/UTC")
    .Events(e => e.Edit("onEdit"))
    .Editable(editable => {
        editable.TemplateName("_EditorTemplatePartial");
        editable.Resize(true);
    })
    .DataSource(d => d
            .Model(m => {   
                m.Id(f => f.TaskID);
                m.Field(f => f.Title).DefaultValue("No title");
                m.RecurrenceId(f => f.RecurrenceID);
                m.Field(e => e.Attendees).DefaultValue(new List<iMail.Web.Models.CalendarAttendeeModel>());
            })
        .Events(e => e.Error("error_handler"))
        .Read("TasksRead", "Dashboard")
        .Create("TasksCreate", "Dashboard")
        .Destroy("TasksDestroy", "Dashboard")
        .Update("TasksUpdate", "Dashboard")
    )
)

Code of _EditorTemplatePartial.cs

<div data-container-for="Attendees" class="k-edit-field">
    @(Html.Kendo().MultiSelectFor(model => model.Attendees)
        .Name("myMultiSelectiHATEYOU")
        .HtmlAttributes(new { data_bind = "value:Attendees" })
         
        .DataTextField("AttendeeName")
        .DataValueField("ID")
        
        .BindTo(ViewBag.Contacts)
        .Value(Model.Attendees)
</div>

Here is the data load in the MultiSelect

ICollection<CalendarAttendeeModel> contacts = new List<CalendarAttendeeModel>();
 
                CalendarAttendeeModel att7 = new CalendarAttendeeModel();
                att7.AttendeeName = "Georgette";
                att7.ID = 4;
                att7.Email = "myemail@attendee7.com";
........
                contacts.Add(att7);
                contacts.Add(att8);
                contacts.Add(att9);
                contacts.Add(att10);
                ViewBag.Contacts = contacts;

The data in the multislect seems to be correctly loaded but when i want to save the data inside of  TasksCreate() i have some trouble with my list.
Sample : If i select 4 item, my list count 4 row but haven't any data inside.
Moreover i can't try to use a datasource because of this template ".Editable(editable => {        editable.TemplateName("_EditorTemplatePartial");"

public ActionResult TasksCreate([Kendo.Mvc.UI.DataSourceRequest]Kendo.Mvc.UI.DataSourceRequest request, TaskViewModel task)
 {
 
}

My CalendarAttendeeModel is a List inside of the model TaskViewModel

public class TaskViewModel : Kendo.Mvc.UI.ISchedulerEvent
    {
....
        public string Title { get; set; }
        public string Description { get; set; }
        public string StartTimezone { get; set; }
        public string EndTimezone { get; set; }
....
        public List<CalendarAttendeeModel> Attendees { get; set; }
}


I can't get the selected data in the list inside of the editor template.
In the TasksCreate i can get the data of Description,... (it's the user who write the data) but for the List, i have a big problem.


I use Kendo UI 2013.3.1511 and Razor engine.

I'm stuck with that :/
Any idea to suceed ?
Shimon
Top achievements
Rank 2
 answered on 26 Mar 2014
7 answers
703 views
Hello -

I have the following TreeView in my application:

@(Html.Kendo().TreeView()
                            .Name("treeview")
                            .ExpandAll(true)
                            .Events(events => events.Select("onTreeNodeSelected"))                                                          
                            .BindTo((IEnumerable<TreeViewItemModel>)ViewBag.NavigationTree))

I have a button on the page that when clicked a KendoWindow gets displayed and allows the user to enter in text for a new node.  On the submit button within the KendoWindow it posts the AJAX form and the ViewBag.NavigationTree gets updated.

How can I have the new node be added to the tree via AJAX?  Essentially I want to update the TreeView's BindTo when the ViewBag.NavigationTree gets updated via an AJAX call.

Thanks in advance,
Dan

Alexander Popov
Telerik team
 answered on 26 Mar 2014
5 answers
846 views
Hi,

I'm trying to redirect to a controller action and pass the ID of the selected tree node into the controller action.

Ideally, I would like to use some code like this:

<div class="kendo-tree">
    @(Html.Kendo().TreeView()
        .Name("treeview")
        .DataTextField("Name")
        .TemplateId("treeview-template")
        .DataSource(dataSource => dataSource
            .Read(read => read.Action("DashboardTree", "Home"))
         )
        .Events(e => e.Select("onSelect"))
    )
</div>
And here's what the onSelect would do:
function onSelect(e) {
    var data = $('#treeview').data('kendoTreeView').dataItem(e.node);
     
    //alert("node clicked" + data.id);
    window.location  = @Url.Action("Edit", "Employee", new { id = data.id });
         
}
I'm not sure if window.location is the way to do this and would welcome better suggestions.  I don't have a form to submit, I just want to go to another page when the user clicks a tree node.  Surely I'm missing something here...

Thanks,
bh
Dimo
Telerik team
 answered on 26 Mar 2014
1 answer
399 views
I have a Kendo button with the click event defined as:

@(Html.Kendo().Button()
                    .Name("btnAddNewLineItem")
                    .Tag("span")
                    .Icon("plus")
                    .Content(@InvSubModule.Infrastructure.Localization.ResourceManager.GetString("AddNew") +"   " + "<span></span>")
                    .HtmlAttributes( new {type = "button"} )
                    .Events(ev => ev.Click("AddLineItemButtonRequest"))                 
                )   

In my JavaScript method: "AddLineItemButtonRequest", the last line sets the focus to another control on the page via jQuery:

$("#LineItemType").focus();

However, after this line, the focus is shifted back to the Kendo button above. Is there another way I should be setting the focus?

Thanks for your time,
Scott Dulock


Dimiter Madjarov
Telerik team
 answered on 26 Mar 2014
2 answers
102 views

What I am trying to do.. is create this grid of CartLines, display them, and allow editing of ONLY the quantity field.
This grid below displays, and is editable (presumably, I haven't implemented the update action but the UI appears to work).

The moment I added .Editable(false) to any of the model.Fields, I get an error that the object is not referring an object ..

  >> Object reference not set to an instance of an object.

and that happens before it even tries to call the read action.  And I am quite surprised about the behavior on the first column, the picture column.  That field is editable also which surprised me. I mean.. I guess i didn't tell it not to.. But it is clearly associating it with the modeId and I would think the modelid is sacred and shouldn't be changed.

Anyway... what's the best way to accomplish this?
  Quantity should be editable
  Nothing else should be editable.
  (though I may add a delete the entire row option)

@(Html.Kendo().Grid<EveShop.Domain.Entities.CartLine>()
   .Name("cartGrid")
   .DataSource(
    dataSource => dataSource
      .Ajax()
      .Read(read => read.Action("GetCartList", "Cart").Data("additionalCartListData"))
      .Model(model =>
      {
        model.Id(p => p.Product.ProductID);
        model.Field(p => p.Product.Name);
        model.Field(p => p.Quantity);
        model.Field(p => p.Product.Price)/*.Editable(false)*/;
      })
    )
    .Columns(columns =>
    {
        // this first column is really just a picture column, may be a better way to do this
        // than binding it to Product.ProductID?  to an empty field?  didn't see how to do that.
      c
olumns.Bound(line => line.Product.ProductID).ClientTemplate("<img src='" + Url.Content("~/Images/Types/") + "#:Product.ProductID#_64.png' alt='#: Product.ProductID #' />").Title("Picture");
      columns.Bound(line => line.Product.Name);
      columns.Bound(line => line.Quantity);
      columns.Bound(line => line.Product.Price);
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))             
)
Alexander Popov
Telerik team
 answered on 26 Mar 2014
1 answer
107 views
I am using the grouping function of the Grid.  I would like to display the "Drag a column header and drop it here to group by that column" message always, not just when there is no grouping, because I have one column that is grouped by default when the page loads, and the user still needs to know how it works.  Is there a way to have this message displayed always?
Dimiter Madjarov
Telerik team
 answered on 25 Mar 2014
4 answers
384 views
I am new to the Kendo UI, and I am trying to use Kendo UI with my ASP.NET MVC 5 project, and would like to incorporate different Bootstrap template into my page layout.

I have seen the demo at the following URL:
http://demos.telerik.com/kendo-ui/bootstrap/

And, I am trying to find the source code for this demo to see if I can use it as a template in my ASP.NET MVC 5 project.  Does anyone know where can I find this sample source code?  

Thank you very much.

Best Regards,

John Jiang
Sebastian
Telerik team
 answered on 25 Mar 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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Security
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
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?