Telerik Forums
UI for ASP.NET MVC Forum
4 answers
138 views
Hi all,
I need help with the "Create" operation.
When I create a new task, the Scheduler doesn't send any data to the Controller method.

My C# object is:

public class Reservation : ISchedulerEvent
    {
        public virtual int IdReservation { get; set; }
        public virtual int? IdWorker { get; set; }
        public virtual int IdRoom { get; set; }
        public virtual string Title { get; set; }
        public virtual string Description { get; set; }
        public virtual DateTime Start { get; set; }
        public virtual string StartTimezone { get; set; }
        public virtual DateTime End { get; set; }
        public virtual string EndTimezone { get; set; }
        public virtual string RecurrenceRule { get; set; }
        public virtual string RecurrenceException { get; set; }
        public virtual bool IsAllDay { get; set; }
        public virtual DateTime ReservationDate { get; set; }
    }

and the Javascript is:

$("#scheduler").kendoScheduler({
        date: new Date("2014/3/25"),
        startTime: new Date("2014/3/25 07:00 AM"),
        height: 600,
        views: [
            "day",
            { type: "workWeek", selected: true },
            "week",
            "month",
            "agenda"
        ],
        timezone: "Etc/UTC",
        dataSource: {
            batch: true,
            transport: {
                read: {
                    url: "/Reservation/Read",
                    dataType: "json",
                    type: "POST"
                },
                update: {
                    url: "/Reservation/Update",
                    dataType: "json",
                    type: "POST"
                },
                create: {
                    url: "/Reservation/Create",
                    dataType: "json",
                    type: "POST"
                },
                destroy: {
                    url: "/Reservation/Delete",
                    dataType: "json",
                    type: "POST"
                },
                parameterMap: function (options, operation) {
                    if (operation !== "read" && options.models) {
                        return { models: kendo.stringify(options.models) };
                    }
                }
            },
            schema: {
                model: {
                    id: "idReservation",
                    fields: {
                        idReservation: { from: "IdReservation", type: "number", defaultValue: 1 },
                        worker: { from: "IdWorker", type: "number", defaultValue: 1 },
                        roomId: { from: "IdRoom", type: "number" },
                        title: { from: "Title", defaultValue: "No title" },
                        description: { from: "Description", defaultValue: "" },
                        start: { from: "Start", type: "date" },
                        startTimezone: { from: "StartTimezone", defaultValue: null },
                        end: { from: "End", type: "date" },
                        endTimezone: { from: "EndTimezone", defaultValue: null },
                        recurrenceRule: { from: "RecurrenceRule" , defaultValue: null },
                        recurrenceException: { from: "RecurrenceException", defaultValue: null },
                        isAllDay: { from: "IsAllDay", type: "boolean", defaultValue: false },
                        reservationDate: { from: "ReservationDate", type: "date", defaultValue: new Date() }
                    }
                }
            }
        }
    });

and, this is my "Create" (MVC Controller) method is:

public virtual JsonResult Create([DataSourceRequest] DataSourceRequest request, Reservation reservation)
{
    ...
}

Please, can anyone help me to know why the properties in the "reservation" parameter ("Create" method) are all empties?

Thanks
Mattia
Top achievements
Rank 1
 answered on 08 Apr 2014
2 answers
133 views
trying to initialize my Kendo ui grid. I am able to populate it using the View object, but when I try doing it in Json format (i.e. when moving to next page) I get a screen showing json results instead of my view.Here's the controller code: public class CampaignsController : Controller
{
//
// GET: /Campaigns/


[HttpGet]
public ActionResult Index()
{
return View(GetAllCampaigns());
}


public ActionResult Campaigns_Read([DataSourceRequest] DataSourceRequest request)
{
DataSourceResult result = GetAllCampaigns().ToDataSourceResult(request);
return Json(result, JsonRequestBehavior.AllowGet);
}


private static IEnumerable<NH_Campaign> GetAllCampaigns()
{
List<NH_Campaign> result = null;
if (MBPDataAccess.Instance.GetAll(out result))
{
return result;
}
return new List<NH_Campaign>();
}and the cshtml is :@model IEnumerable<MBP.NH_Campaign>

<h2>View1</h2>


@(Html.Kendo().Grid(Model)
.Name("CGrid")
.Columns(columns =>
{
columns.Bound(p => p.CampaignID).Title("Id");
columns.Bound(p => p.CampaignName).Title("Name");
columns.Bound(p => p.ClickUrlC2C_OFF).Title("Click URL");
columns.Bound(p => p.PlatformID).Title("Platform ID");
})
//.Groupable()
.Pageable()
//.Sortable()
//.Filterable()
.DataSource(dataSource => dataSource.Ajax().PageSize(2).Read(read => read.Action("Campaigns_Read", "Campaigns"))
));the Index action that is called when the page is loaded works great, but when I try to move to the next page the Camapigns_Read action is called but I get a blank page with json results.
 i want to perform paging on server-side
What am I missing here? 
Richard
Top achievements
Rank 1
 answered on 08 Apr 2014
1 answer
132 views
Hi,
I am quite new to telerik and having some problem with datetime picker.
@Html.Kendo().DatePicker().Name("dtpicker")) is the code i am using. It does not show any error but only shows textbox instead of showing datetime picker control.

Thanks.
Atanas Korchev
Telerik team
 answered on 07 Apr 2014
4 answers
309 views

I am working an application using Kendo Grid on an MVC application.  Starting at about 10:30 (central time) yesterday, the kendo grid software stopped working.  I am using IE 10 on a Windows 7 OS. The error is

Unhandled exception at line 3, column 23238 in http://cdn.kendostatic.com/2014.1.318/js/jquery.min.js
0x80020003 - JavaScript runtime error: Member not found.

I am able to replicate the error in a simple application.  The View file contains the following definition for the grid

 

@(Html.Kendo().Grid<MvcApplication1.Models.TestItem>()
  .Name( "testItemGrid" )
  .Columns( columns =>
  {
    columns.Command( command =>
    {
      command.Edit();
    } ).Width( 195 );
    columns.Bound( x => x.ItemId );
    columns.Bound( x => x.Name );
  } )
  .ToolBar( toolbar =>
  {
    toolbar.Create().Text( "Add New Item" );
  } )
  .Sortable()
  .Editable( editable => editable.Mode( GridEditMode.InLine ) )
  .DataSource( ds => ds
    .Ajax()
    .Model( m =>
            {
              m.Id( x => x.ItemId );
            } )
     .Read( "TestItemRead", "TestItemGrid" )
     .Create( "TestItemCreate", "TestItemGrid" )
     .Update( "TestItemUpdate", "TestItemGrid" )
    )
  )

 

The controller contains the following actions:
 

public class TestItemGridController : Controller
{
  public ActionResult Index()
  {
    return View();
  }
 
  public ActionResult TestItemRead( [DataSourceRequest] DataSourceRequest request )
  {
    List<Models.TestItem> items = new List<Models.TestItem>();
    items.Add( new Models.TestItem() { ItemId = 1, Name = "Item 1" } );
    items.Add( new Models.TestItem() { ItemId = 2, Name = "Item 2" } );
    items.Add( new Models.TestItem() { ItemId = 3, Name = "Item 3" } );
    items.Add( new Models.TestItem() { ItemId = 4, Name = "Item 4" } );
    items.Add( new Models.TestItem() { ItemId = 5, Name = "Item 5" } );
    return Json( items.ToDataSourceResult( request ) );
  }
 
  public ActionResult TestItemCreate( [DataSourceRequest] DataSourceRequest request, Models.TestItem testItem )
  {
    if( testItem != null && ModelState.IsValid )
    {
    }
    return Json( new[] { testItem }.ToDataSourceResult( request, ModelState ) );
  }
 
  public ActionResult TestItemUpdate( [DataSourceRequest] DataSourceRequest request, Models.TestItem testItem )
  {
    if( testItem != null && ModelState.IsValid )
    {
    }
    return Json( ModelState.ToDataSourceResult() );
  }
}

 

I have tried several things to fix the error:
1. Update to latest version of Telerik software
 2. Use CDN support
 3. Use Local support

 I am at my wits end to resolve this issue.  Please help!

Leon
Top achievements
Rank 1
 answered on 07 Apr 2014
7 answers
412 views
Successfully using the HTML Editor, I would like to give my users the ability to resize the editor window (like shown in the attachment scribble).



My question:

Is it possible to turn on this functionality or simulate it in some way (maybe something with splitter?)
Dimo
Telerik team
 answered on 07 Apr 2014
2 answers
203 views
I'm using Kendo UI Grid to populate list of data and when i click on particular row i need to redirect to another view page of that particular row. but i have a delete command for that particular row. When i try to delete particular row it redirect to another page.i don't need any redirection after deletion. so the possible solution is i want to deselect only the command column when i select a particular row. Both i need row selection but no need command column selection..Please give a solution  for this...

  @(Html.Kendo().Grid<Portal.Presentation.Web.BoundedContext.TNA.Template.MVC.Areas.Razor.Models.TemplateModel>()
                  .Name("grid_Template_Freeze")
                  .AutoBind(true)
                  .Groupable()
                  .Sortable()
                  .HtmlAttributes(new { style = "border: 0;" })
                  .Scrollable(a => a.Height("auto"))
                          .Selectable(sel => { sel.Mode(GridSelectionMode.Single); sel.Type(GridSelectionType.Row); sel.Enabled(true);
                          })
                  .Columns(c =>
                               {
                                   c.Bound(p => p.TemplateId).Hidden();
                                   c.Bound(p => p.TemplateName).Title("&nbsp;").Title("TEMPLATE NAME");
                                   c.ForeignKey(p => p.ProductTypeId, (System.Collections.IEnumerable) ViewData["ProductTypes"], "Key", "Value").Title("PRODUCT TYPE");
                                   c.ForeignKey(p => p.OwnershipId, (System.Collections.IEnumerable)ViewData["UserTypes"], "Key", "Value").Title("OWNERSHIP");
                                   c.Bound(p => p.CreatedOn).Title("CREATED DATE").Format("{0:dd/MM/yyyy hh:mm}");
                                   c.Bound(p => p.UpdatedOn).Title("LAST MODIFIED DATE").Format("{0:dd/MM/yyyy hh:mm}");
                                   c.ForeignKey(p => p.StatusId, (System.Collections.IEnumerable)ViewData["StatusTypes"], "Key", "Value").Title("STATUS");
                                   c.Command(command => command.Destroy()).Width(80);

                               })
                  .Events(evt => evt.Change("TemplateTaskHandler.onChange"))
                  .DataSource(dataSource => dataSource
                                                .Ajax()
                                                .Sort(sort => sort.Add(p => p.TemplateName).Descending())
                                                .Model(model =>
                                                               {
                                                                   model.Id(p => p.TemplateId);
                                                                   model.Field(p => p.TemplateId);
                                                               })
                                                .Events(events => events.Error("error_handler"))
                                                .PageSize(20).ServerOperation(false)
                                                .Destroy(destroy => destroy.Action("OnTempaleDelete", "List"))
                                                .Read(read => read.Action("OnTempaleRead", "List"))
                  ).Pageable(x => { x.Enabled(true); x.PreviousNext(true); x.PageSizes(true); x.Info(true); x.Input(true); x.Numeric(false); x.Refresh(true); }))



 var TemplateTaskHandler = {

        onChange: function (e) {

            var grid = $("#grid_Template_Freeze").data("kendoGrid");
            var item = grid.dataSource.data()[grid.select().index()];
            location.href = "@Model.ResolveRouteUrl(Portal.Presentation.Web.BoundedContext.TNA.Template.MVC.Areas.Razor.Models.TnaModelTypes.Update)" + "&tmpl=" + item.TemplateId;
        }
    };
}
administrator
Top achievements
Rank 1
 answered on 07 Apr 2014
1 answer
154 views
I'm work on asp.net mvc application, I used kendo UI controls in my application
I added many controls from kendo UI tools ,it worked correctly
when I tried to add Html.Kendo().ComboBox() tool it displayed in browser like text field not combo box and it didn't displayed any item of the control
I wrote the following example

@(Html.Kendo().ComboBox().Name("kcombobox").Placeholder("Select a value...") .BindTo(new string[] {"Bulgaria", "United States", "India","Australia", "United Kingdom"}  ) )

so where is the problem please
Dimo
Telerik team
 answered on 04 Apr 2014
3 answers
319 views
I am using the UI for ASP.NET MVC controls in my application and I need to be able to create PDFs of a view that dynamically loads data.  Is this possible and if so how would I go about doing it?
Stef
Telerik team
 answered on 04 Apr 2014
3 answers
235 views
Hi Guys,

First of all, here's my grid definition

@(Html.Kendo().Grid<DATACLASS_ATTRIBUTES_T012>()
            .Name("Grid")
            .ToolBar(commands => { commands.Create().Text("New Attribute"); })
            .Columns(columns =>
            {
                columns.ForeignKey("ATTRIBUTEID", ViewBag.Attributes).ClientTemplate("#: data.DC_ATTRIBUTES_T006 ? DC_ATTRIBUTES_T006.NAME : 'none'#").Width(270);
                columns.Command(command => { command.Edit().UpdateText("Save"); }).Width(173);
                 
            })
            .Pageable()
            .Sortable()
            .Scrollable()
            .Filterable()
            .Editable(mode => mode.Mode(GridEditMode.InLine))
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(5)
                .ServerOperation(false)
                .Model(model =>
                {
                    model.Id(v => v.ID);
                    model.Field(v => v.ATTRIBUTEID).DefaultValue(1);
                    model.Field(v => v.UOM_ID).DefaultValue(null);
                    model.Field(v => v.DATACLASS_ID).DefaultValue(Model.ID);
                })
                .Read(r => r.Action("GetAttributeByDataClass/" + Model.ID, "Attribute"))
                .Update(r => r.Action("UpdateDataClassAttribute", "Attribute"))
                .Create(r => r.Action("CreateDataClassAttribute", "Attribute"))
             )
        )

My validation issue is that, on create, if I try to save without selecting a value for UOM_ID, I get the "The field Measure Unit must be a number." error.
Here is the data annotation related to this field

[UIHint("MeasureUnitEditor")]
[Display(Name = "Measure Unit")]
public Nullable<int> UOM_ID;

How come that validation doesn't succeed when the dafault value for that field is null (as defined inside grid's model) and the model's field is Nullable??

My Goal here is to build a custom creation process...I'd like to set the measure unit only if the value choosen from the first field (attributeID - rendered as a combo) is of a certain type...
Is it possible?

Thanks
Fabio
Petur Subev
Telerik team
 answered on 04 Apr 2014
3 answers
134 views
Can we use the mobile mvc tabstrip with web?
I cant seem to get any css on my tabstrip

Also when initializing tabstript this messes up bootstrap menu, menu now covers page content.
Where am I going wrong,
Thanks


   
         @code
 Dim mobileTab As Kendo.Mvc.UI.MobileTabStrip = Html.Kendo.MobileTabStrip().Name("mobileTab").Items(Sub(items)
items.Add().Icon("contacts").Text("Products")
items.Add().Icon("cart").Text("Shopping Cart")
 End Sub) _
 .Events(Function(events) events.Select("onSelect"))
 
 
mobileTab.Render()
 End Code
         
      
        @Html.Kendo().MobileApplication().ServerNavigation(true)
Kiril Nikolov
Telerik team
 answered on 04 Apr 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?