Telerik Forums
UI for ASP.NET MVC Forum
2 answers
521 views

When editing an event that has already occurred and not to recur again, the user should be able to see the Edit window but have everything disabled and read-only for viewing the details of the event but not allowed to make changes or save.

What I have so far is after the logic for determining the event has ended and never to recur again to add the "k-state-disabled" class and set the pointer-events style to none so all controls in the k-edit-form-container are not clickable. This encompasses the entire edit window rather than explicitly disabling each and every control:

function onEdit(e) {
   // custom logic...
   // if disabling editing then
   // * add telerik disabled class to show all controls as disabled
   // * set pointer-events style to prevent the controls from being active
   if (disableEditing) {
      $('.k-edit-form-container').addClass("k-state-disabled").css("pointer-events", "none");
   }
}

 

The only issue is the k-edit-form-container also includes the save and cancel buttons as well so the only way for the Edit form to be closed is the 'X' in the upper/right.  This causes a lot of confusion for our users since they do not initially understand the only way to close the window is the X and they often get "stuck" not knowing how to close it.

Is there a more recommended way to disable the edit window to display read-only and also presenting a "Close" button?  I am using a customized template editor.

 

 

 

 

Erik
Top achievements
Rank 1
 answered on 18 Apr 2017
5 answers
487 views

Hi. I'm trying to use the grid to display some data which a user is supposed to change. The problem is that so far I have been unsuccessful in making the grid update/edit or delete, nothing happens when I click the "Save" button. Or when I press enter. It just doesn't hit the controller when I set a break point. If I create or read, it works fine.

To create the project I did the following

  1. Started a new MVC project though the basic asp.net web wizard
  2. Converted to telerik application to UI for ASP.net MVC
  3. Updated all scripts to their newest version
  4. Enabled entity framework migrations with automatic migrations.

My versions are:
* jQuery 1.10.2
* KendoUI 2014.1.415
* Bootstrap 3.0.0.0
* MVC 5.1.0.0

ManageWorkPlacements.cshtml

01.@(Html.Kendo().Grid<WorkPlacementModel>()
02.            .Name("Grid")
03.            .Columns(columns =>
04.            {
05.                columns.Bound(p => p.Name);
06.                columns.Bound(p => p.CvrNumber);
07.                columns.Command(command => command.Destroy()).Width(110);
08.            })
09.            .ToolBar(toolbar =>
10.            {
11.                toolbar.Create();
12.                toolbar.Save();
13.            })
14.            .Editable(editable => editable.Mode(GridEditMode.InCell))
15.            .Pageable()
16.            .Navigatable()
17.            .Sortable()
18.            .Scrollable()
19.            .DataSource(dataSource => dataSource
20.                .Ajax()
21.                .Batch(true)
22.                .PageSize(20)
23.                .ServerOperation(false)
24.                .Events(events => events.Error("error_handler"))
25.                .Model(model => model.Id(p => p.Id))
26.                .Create("WorkPlacement_Create", "WorkPlacement")
27.                .Read("WorkPlacement_Read", "WorkPlacement")
28.                .Update("WorkPlacement_Update", "WorkPlacement")
29.                .Destroy("WorkPlacement_Destroy", "WorkPlacement")
30.            )
31.        )
32.        <script type="text/javascript">
33.            function error_handler(e) {
34.                if (e.errors) {
35.                    var message = "Errors:\n";
36.                    $.each(e.errors, function (key, value) {
37.                        if ('errors' in value) {
38.                            $.each(value.errors, function () {
39.                                message += this + "\n";
40.                            });
41.                        }
42.                    });
43.                    alert(message);
44.                }
45.            }
46.        </script>

WorkPlacementController.cs
01.using System;
02.using System.Collections.Generic;
03.using System.Linq;
04.using System.Web;
05.using System.Web.Mvc;
06.using Kendo.Mvc.Extensions;
07.using Kendo.Mvc.UI;
08.using RegistreringMVC.Migrations;
09.using RegistreringMVC.Models;
10.using RegistreringMVC.Services;
11. 
12.namespace RegistreringMVC.Controllers
13.{
14.  public class WorkPlacementController : Controller
15.  {
16.    private WorkPlaceService workPlacementService;
17. 
18.    public WorkPlacementController()
19.    {
20.      workPlacementService = new WorkPlaceService(new RegistreringEntities());
21.    }
22. 
23.    public ActionResult WorkPlacement_Read([DataSourceRequest] DataSourceRequest request)
24.    {
25.      return Json(workPlacementService.Read().ToDataSourceResult(request));
26.    }
27. 
28.    [AcceptVerbs(HttpVerbs.Post)]
29.    public ActionResult WorkPlacement_Create([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<WorkPlacementModel> workPlacements)
30.    {
31.      var results = new List<WorkPlacementModel>();
32. 
33.      if (workPlacements != null && ModelState.IsValid)
34.      {
35.        foreach (var workPlacement in workPlacements)
36.        {
37.          workPlacementService.Create(workPlacement);
38.        }
39.      }
40. 
41.      return Json(results.ToDataSourceResult(request, ModelState));
42.    }
43. 
44.    [AcceptVerbs(HttpVerbs.Post)]
45.    public ActionResult WorkPlacement_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<WorkPlacementModel> workPlacements)
46.    {
47.      if (workPlacements != null && ModelState.IsValid)
48.      {
49.        foreach (var workPlacement in workPlacements)
50.        {
51.          workPlacementService.Update(workPlacement);
52.        }
53.      }
54. 
55.      return Json(workPlacements.ToDataSourceResult(request, ModelState));
56.    }
57. 
58.    [AcceptVerbs(HttpVerbs.Post)]
59.    public ActionResult WorkPlacement_Destroy([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<WorkPlacementModel> workPlacements)
60.    {
61.      if (workPlacements.Any())
62.      {
63.        foreach (var workPlacement in workPlacements)
64.        {
65.          workPlacementService.Destroy(workPlacement);
66.        }
67.      }
68. 
69.      return Json(workPlacements.ToDataSourceResult(request, ModelState));
70.    }
71.  }
72.}

The code is taken almost directly from the offline samle (just to make it work). But still it doesn't. I tried remaking the whole project, in case I had changed something without thinking about it. But this does not help either. If you require any further code, please reply and i'll add it.

Thank you
Daniel

Boyan Dimitrov
Telerik team
 answered on 18 Apr 2017
6 answers
5.7K+ views
Hello,
i tried to make an upgrade in order to use the tooltip and other new things,or resolved bugs.
but after the upgrade,with the Telerik Control Panel,it was a mess,he only made a backup of my example project,but when i tried to use the tooltip,i noticed that there is no kendo.tooltip.js ,in the /Content folder
i had only /kendo/2012.3.1315  subfolder where are a lot of js files,and the themes,so i have to change manually the reference to the folder where are the new version of files.

the question is what do i need to copy manually in order to use everything from the latest versions of kendo ui for MVC(controls,framework functions,etc) ?
i want to copy everything manually,and work with everything that i had before + the new features.in the real application i do not want to re-create the project from a template,just to put everything togheter nicely.

Regards,
Daniel
P.S:i attach 2 files(the error and the reference section from layout.cshtml)  after i copied manually everything from Telerik\Program Files March Q1 2013 to a new subfolder in my project and referenced
Dyanko
Telerik team
 answered on 18 Apr 2017
1 answer
852 views

I am using the grid in an MVC environment. I am trapping the Save event as follows:

                .Events(events => events.Change("gridRowChange").Edit("onEdit").Save("onSave"))

Is there an event I can trap that fires after the save has been completed and successful?

Viktor Tachev
Telerik team
 answered on 18 Apr 2017
2 answers
166 views

Hy,
I created a Spreadsheet. But I want to add a class to the SpreadsheetSheetRowCell Value attribute. The cell only shows me [object Object] in the view. I tried to override the toString method but with no effect.

As an example if my class looks like:
public class User
{
    public int ID { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

How can I display the first and the last name?
Thx for Help!

Stephan
Top achievements
Rank 1
 answered on 18 Apr 2017
1 answer
189 views

Hi,

I am currently using a Grid with a SignalR datasource and expandable rows to show a Detail Template, every time a new record is created in the grid from the server (onPush) it collapses any/all detail templates which you may have been viewing. Kinda annoying, any way to resolve this?

@(Html.Kendo().Grid<Models.MyView>()
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Column1);
        columns.Bound(p => p.Column2);
    })
    .ClientDetailTemplateId("template")
    .Sortable()
    .Scrollable(s => s.Height("auto"))
    .Filterable()
    .Pageable()
    .Navigatable()
    .DataSource(dataSource => dataSource
        .SignalR()
        .AutoSync(true)
        .ServerFiltering(true)
        .ServerPaging(true)
        .ServerSorting(true)
        .ServerAggregates(true)
        .ServerGrouping(true)
        .PageSize(20)
        .Events(events => events.Push("onPush"))
        .Sort(s => s.Add("Posted").Descending())
        .Transport(tr => tr
            .Promise("hubStart")
            .Hub("hub")
            .Client(c => c
                .Read("read")
                .Create("create")
                .Update("update")
                .Destroy("destroy")
            )
            .Server(s => s
                .Read("read")
                .Create("create")
                .Update("update")
                .Destroy("destroy")
            )
        )
        .Schema(schema => schema
            .Data("Data")
            .Total("Total")
            .Aggregates("Aggregates")
            .Groups("Groups")
            .Model(model =>
            {
                model.Id("ID");
                model.Field("Column1", typeof(string));
                model.Field("Column2", typeof(string));
            })
        )
    )
)

<script id="template" type="text/kendo-tmpl">
   @(Html.Kendo().TabStrip()
            .Name("tabStrip_#=ID#")
            .SelectedIndex(0)
            .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
            .Items(items =>
            {
                items.Add().Text("Detail")
                    .LoadContentFrom("Detail", "Home", new { ID= "#=ID#" })
                    .Selected(true);
            })
            .ToClientTemplate())
</script>

 

Thanks!

Stefan
Telerik team
 answered on 17 Apr 2017
2 answers
410 views

I have an MVC grid with the following settings:

 

                .Editable(editable => editable.Mode(GridEditMode.InLine))   
                .Navigatable()                                              

When the user is editing a row, I need to be able to trap when he/she leaves a particular cell so that I can perform a lookup on the value of the cell and place a default value in another cell. 

How can I capture the event that occurs when a user leaves a cell?

 

Randy
Top achievements
Rank 1
 answered on 14 Apr 2017
2 answers
159 views

Hello,

I have a startTime and a endTim on my Scheduler: from 7 AM to 16PM and I wonder if It's possible to hide one hour from 12 pm to 13pm.

@(Html.Kendo().Scheduler<KendoSchedulerMVC.Controllers.TAS_TasksViewModel>()
    .Name("scheduler")
    .Timezone("Etc/UTC")
    .Date(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day))
    .Height(800)
    .StartTime(new DateTime(2013, 6, 13, 7, 00, 00))
    .EndTime(new DateTime(2013, 6, 13, 16, 00, 00))

    .Editable(editable => editable
        .EditRecurringMode(SchedulerEditRecurringMode.Dialog)
    )
    .Selectable(false)
    .Views(views => {
        views.DayView();
        views.WorkWeekView();
        views.WeekView(w => w.Selected(true));
        views.MonthView();
        views.AgendaView();
    })
    .DataSource(d => d
        .Model(m => {
            m.Id(f => f.tas_id);
            m.Field(f => f.Title).DefaultValue("No title");
            m.RecurrenceId(f => f.RecurrenceID);
        })
        .Read(read => read.Action("TAS_Tasks_Read", "Scheduler"))
        .Create(create => create.Action("TAS_Tasks_Create", "Scheduler"))
        .Update(update => update.Action("TAS_Tasks_Update", "Scheduler"))
        .Destroy(destroy => destroy.Action("TAS_Tasks_Destroy", "Scheduler"))
    )
)

 

Thank you

 

Julien
Top achievements
Rank 1
 answered on 14 Apr 2017
1 answer
90 views

Hello,

I have already a startTime and endTime on my scheduler and I wa     

Ivan Danchev
Telerik team
 answered on 14 Apr 2017
8 answers
1.2K+ views
I have a grid which is editable in popup mode. I have two problems the first is that when the popup is shown it is too small and I have to scroll left to see the whole text box. Second I do not want the user to be able to change the UserId field as this is a key field generated by the database. So I either want the field hidden (including the label) or I want it disabled. 

Having looked at the forums I think the only way to solve this is to use a template. I tried to add a template but the popup does not use it, I am new to Kendo and Javascript so would appreciate if someone could tell me why it is not picking up my template. Both Grid code and template are shown below.

@(Html.Kendo().Grid(Model)
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.UserId).Hidden(true).Width(100);
        columns.Bound(p => p.Username).Width(200);
        columns.Bound(p => p.Password).Width(250);
        columns.Command(command => { command.Edit(); });
    })
    .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("AddEditUser"))
    .Pageable()
    .Sortable()
    .Scrollable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(u => u.UserId))
        .Read("Users", "Home")
        .Update("UserListUpdate", "Home")
    )
)
 
<script id="AddEditUser" type="text/kendo-tmpl">
    <div class="k-edit-label">UserId: </div>
    <div class="k-edit-field">
        <input name="UserId" disabled class="k-textbox" />
    </div>
    <div class="k-edit-label">UserName: </div>
    <div class="k-edit-field">
        <input name="Username" required class="k-textbox" />
    </div>
    <div class="k-edit-label">Password: </div>
    <div class="k-edit-field">
        <input name="Password" required class="k-textbox" />
    </div>
</script>


Thank you
Dimiter Madjarov
Telerik team
 answered on 14 Apr 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
DropDownButton
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
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
LLM Kit
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?