Telerik Forums
UI for ASP.NET MVC Forum
1 answer
367 views

I have been trying to make Kendo MVC be able to display dates like "March 5 2013" using Kendo MVC. 

 

I am also using JQuery Validator. It is very unclear to me how the validator and the date format work together, and I cannot see any documentation for how this works, and can be adjusted. 

Code in the CSHTML file : 

 

@(Html.Kendo().DatePickerFor(m => m.StartDate).Format("yyyy-MM-dd") 

in my CS m.StartDate is just a .net DateTime object. 

I have found that no matter what, I cannot get the dates to bind correctly in chrome unless I use the date format above (If I do not supply dates in the above format, the date field is blank)

 

I have added the locale specific scripts, so that doesn't appear to be an issue.

I have also tried applying 

[DisplayFormat(DateFormatString="MMMM dd yyyy")] to the StartDate object being passed through in my model. 

 

It seems like the Date handling for non locale specific dates in  Kendo is really badly broken - I am hoping that I am missing something. 

 

Looking at the data being passed to the browser, it appears that it uses the DateFormatString to define how to send the data across the wire, and then relies on the client JavaScript having the correct locale defined so that the two match. This in my opinion is just asking for trouble, and very fragile.

Is there a way that we can define a single format (regardless of locale ) to send across the wire, and the use the displayformat ONLY to display the data?

I have searched the forums, and looked through the documentation, but alas, I cannot see a way to make this work sensibly. 

There does not seem to be a custom date format example anywhere that works :(

Please correct me if I am wrong. 

 

 

 

Stefan
Telerik team
 answered on 29 May 2017
5 answers
364 views

Hello,

I have some issues with the scheduler:

- I create an event and go back to his edit form right after, if I click on Cancel the event disapears. If I refresh the scheduler the event is still there and I can cancel the event i won't disapear .

I  saw the same problem in another ticket (http://www.telerik.com/forums/events-disappear-after-canceling-the-detail-modal---help) but my event has an ID when I controll it in DEGUB.

- I have the same issue when I create an event and modify it right after. The event will be duplicated. But if I refresh the sheduler after the creation, I can modify it and it won't be duplicated.

 

I think both issues are linked. Do you have a solution ?

Thank you,

Julien
Top achievements
Rank 1
 answered on 26 May 2017
1 answer
149 views

The following is my code for Updating. I have a custom view model that is a combination of 2 sql tables. The updates are processed successfully, but the dirty bit red triangle does not disappear. I have other grids in my solution that are bound directly to a specific sql table and those grids work as expected, the dirty bit disappears on successful updates to the database. What can I do in order to get the dirty bit cleared for my custom view?

[AcceptVerbs(HttpVerbs.Post)]
 public ActionResult Update([DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<MenuProjectView> menuprojectviews)
        {
            try
            {
                if (menuprojectviews != null && ModelState.IsValid)
                {
                    foreach (var menuprojectview in menuprojectviews)
                    {
                        WorxMenus menu = db.WorxMenus.SingleOrDefault(s => s.Id == menuprojectview.MenuId);
                        menu.Title = menuprojectview.Title;
                        menu.Ordering = menuprojectview.Ordering;
                        menu.Date_Modified = DateTime.UtcNow;
                        Project project = db.Projects.SingleOrDefault(s => s.Id == menuprojectview.ProjectId);
                        project.ProjectType = (int)ProjectTypes.Schema;
                        project.SchemaName = menuprojectview.Title;
                        project.Date_Modified = DateTime.UtcNow;
                        db.SubmitChanges();
                    }
                }
                return Json(new[] { menuprojectviews }.ToDataSourceResult(request, ModelState));
            }
            catch (Exception e1)
            {
                ModelState.AddModelError("", e1.Message);
                return Json(ModelState.ToDataSourceResult(), JsonRequestBehavior.AllowGet);
            }
        }
Konstantin Dikov
Telerik team
 answered on 26 May 2017
3 answers
157 views

Hi,

When I edit an activity in my gantt I have many fields in the popup edit including a multiselect. This multiselect should be different for each activity.

For load the datasource I put the code below in my function Gantt edit :

<p> $.get('/Activity/ReadMultiSelectActivities?initiativeId=' + @Model.ID + '&excludeSectorId=' + $('#SectorID').val() + "&activityID=" + e.task.id, function (data, status) {<br>   allActivitiesDataSource = new kendo.data.DataSource({<br>       data: data.Data,<br>      group: { field: "SectorName" },</p><p>       sort: { field: "ActivityNumberString", dir: "asc" }<br>   });<br>});</p>

When I go the first time on my edit activity the list is empty but if I go an second time the list is OK. Then if I go on an other activity, the previous list is displayed.

It's like my list is charge after the display of my popup edit.

I try many things. Like use refresh(), data.read(), put some code in the multiselect Databound... But nothing work!

 

Do you know how to do it please?

 Thanks for advance

Nencho
Telerik team
 answered on 25 May 2017
3 answers
248 views

I used the MVC example which works perfect as-is I rewrote to work with a JSON request and it ALSO works fine, however when I try to view the data in a string it is trying to display the OBJECT and not the data inside the object. I ASSUMED that the SelectedData is also in JSON format becuase the MultiSelect datasourse is a JSON object.  

 

@(Html.Kendo().MultiSelect()
         .Name("GridSelect")         
         .AutoClose(false)
         .Placeholder("Select Which Grids to Print...") 
         .DataTextField("MapName")
         .DataValueField("Pagenumber")
         .DataSource(source =>
                     {
                         source.Read(read =>
                         {
                             read.Action("GetCascadeGrid100", "GridPrint")
                             .Data("filterGrid100");
                         })
                         .ServerFiltering(true);
                     })       
   )

 

 

So my issue is when I create click button function and I want to display the selected items..  here is what I have tried and the results.  I just want to display my data in a string   Mapname:1 PageNumber:234, Mapname:3, PageNumber:3244 etc...  

 

$(document).ready(function () {
              
            var Gridselect = $("#GridSelect").data("kendoMultiSelect");
 
 
            
 
            $("#get").click(function () {
 
              alert( Gridselect.value + ",  "  + Gridselect.text + ",");
  // this displays nothing but the commas
 
// Also have tried
 
               var output = '';
                for (var entry in Gridselect) {
                    output += 'key: ' + entry + ' | value: ' + Gridselect[entry] + '\n';
                }
 
                alert(output);
// This displays a bunch of data but none of my values, it seems to parse the PageNumber and the MapName so there is something in there.
 
// Also Tried 
 
            alert(Gridselect.toSource);
 
 
            });
});

 

Konstantin Dikov
Telerik team
 answered on 25 May 2017
2 answers
270 views

I have an editable grid using InCell as the Edit Mode.  I have one field that is editable.  When that cell gets focus I want it to select the contents of the cell.  So for instance if the cell contains "100" and it gets focus I want the "100" to be selected so that the user can type over it with out having to backspace.   I have tried putting a this.select();  in the onEdit Code when that column is being edited but it isn't working.

Thx for help

Lee

Lee
Top achievements
Rank 1
 answered on 24 May 2017
5 answers
680 views

I am trying to capture the filter event in my Kendo grid as we are saving grid state in Local storage using Angularjs.  Server-side filter works, but the "filter event" on the grid does not fire.  Is there something more I need to do? Here is a code snippet

              pageSize: 25,
              serverPaging: true,
              serverFiltering: true,
              serverSorting: true
          }),
          width: "100%",
          sortable: true,
          reorderable: true,
          pageable: true,
          columnMenu: false,
          resizable: true,
          filterable: true,
          filter: function(e) {
              if (e.filter == null) {
                  console.log   ("filter has been cleared");
              } else {
                  console.log(e.filter.logic);
                  alert(e.filter.filters[0].field);
                  console.log(e.filter.filters[0].operator);
                  console.log(e.filter.filters[0].value);
              }
          },

Boyan Dimitrov
Telerik team
 answered on 24 May 2017
1 answer
292 views

you can set save / cancel buttons text buy UpdateText and CancelText of command.Edit()

columns.Command(command => { command.Destroy().Text(" "); command.Edit().HtmlAttributes(new { style = " " }).Text(" ").UpdateText("Сохранить").CancelText("Отмена"); }).Width(100);

 

what if I need only delete button present in grid? (so user can add or delete items)?

if I remove edit command I will get default button names. If I set command.Edit(). HTMLAttributes display to none I will get no edit button but also I get NO save update buttons in popup

Preslav
Telerik team
 answered on 23 May 2017
3 answers
451 views

I am using Kendo Spreadsheet for ASP.Net MVC and using it inside the Kendo window.

I need to customize the spreadsheet toolbar to add a custom button (Save) option for the users to save the spreadsheet.

I could see the reference for toolbar customization using Kendo UIJavascript , but not with MVC. Please suggest how to add a custom button in spreadsheet toolbar using MVC.

 

Nencho
Telerik team
 answered on 23 May 2017
1 answer
1.2K+ views

This seems like it should be fairly simple and yet here I am.

I have a grid with inline editing.  I have set an editor template for a column to have a dropdown list.  This column is bound to a property that is set according to an enum.  All of that works great, and I get a dropdown with the names.

However, it always posts to the database as null.  All I want is the dropdown to show names when editing, post the value when creating or editing, then display the name when just viewing.

I have scoured forums but continue to come up empty.

Model

public class Issue
{
    public int Id { get; set; }
    ...
    ...
    public Urgency? Urgency { get; set; }
    ...
    ...
}

 

Enum

public enum Urgency
{
    Low = 1,
    Medium = 2,
    High = 3,
    Critical = 4
}

 

EditorTemplate View

@(Html.Kendo().DropDownList()
        .Name("Urgency")
        .BindTo(Enum.GetNames(typeof(Urgency)).ToList())
)

I have tried many other things but this is where my code is at the moment.

 

What am I missing?

Georgi
Telerik team
 answered on 22 May 2017
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
Security
ColorPicker
DateRangePicker
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
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?