Telerik Forums
UI for ASP.NET MVC Forum
3 answers
309 views
Hello.
I have a scheduler and an EditorTemplate.
I want to bind a multiselectfor after the reading method. (with my Model which is populated in the read Method).
I suppose the .BindTo() Display nothing because the read method 'll be call after this one.

So here is my scheduler :

@(Html.Kendo().Scheduler<iMail.Web.Models.TaskViewModel>()
            .Name("scheduler")
            .Date(DateTime.Now)
            .Timezone("Etc/UTC")
            .Views(views =>
            {
                views.DayView();
                views.WeekView();
                views.MonthView();
                views.AgendaView(agenda => agenda.Selected(true));
            })
            .Selectable(true)
            .Timezone("Etc/UTC")
            .Events(e =>
            {
                e.Edit("onEdit");
                e.Change("onChange");
            })
            .Editable(editable =>
            {
                editable.TemplateName("_EditorTemplatePartial");
            })
            .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(f => f.Priority);
                        m.Field(f => f.TypeID);
                    })
                .Events(e => e.Error("error_handler"))
                .Read (read => read.Action("TasksRead", "Calendar").Data("additionalInfo").Type(HttpVerbs.Get))
                .Create(create => create.Action("TasksCreate", "Calendar").Data("additionalInfo"))
                .Destroy(destroy => destroy.Action("TasksDestroy", "Calendar").Data("additionalInfo"))
                .Update(update => update.Action("TasksUpdate", "Calendar").Data("additionalInfo"))
            )
        )



And here is my MultiSelectFor in the _EditorTemplatePartial.cs file.
<div id="AttendeeAlreadyInvited">
    <div data-container-for="AlreadyInvitedID" class="k-edit-field">
        @(Html.Kendo().MultiSelectFor(model => model.AlreadyInvitedID)
            .HtmlAttributes(new { data_bind = "value:AlreadyInvitedID" })
            .DataTextField("Name")
            .DataValueField("ID")
            .BindTo(Model.Invited) 
        )
    </div>
</div>

Model.Invited has a structure like this :

public class CalEmployeeLight
{
  public int ID;
  public string Name;
 }

Here is a part of my model :

public class TaskViewModel : Kendo.Mvc.UI.ISchedulerEvent
{
   public int TaskID { get; set; } //each event have an ID.
   .....
   public IEnumerable<
int> AlreadyInvitedID { get; set; }
   public ICollection<CalEmployeeLight> Invited { get; set; }
}

Each event in the Scheduler have an ID (TaskID)

The Model is populated in the TaskRead fct and works correctly.
But my multiselectFor is empty.

How can i use .bindTo() fct in the MultiSelectFor() after the Model is populated by "TaskRead" ?

Alexander Popov
Telerik team
 answered on 21 Apr 2014
2 answers
199 views
Hi,

          I trying to do on treeview item select populate the kendogrid something like this EXAMPLE ..  which used dropdownlist instead of treeview , I'm trying to do the same for treeview any help appreciated.


Thank you
Bharathi
Top achievements
Rank 2
 answered on 18 Apr 2014
1 answer
311 views
Hi,

I'm currently developing an application with the support of Windsor Castle (DI container).

As I also want to use Kendo in this project, I started with a simple Grid.

Suddenly the Exception "no parameterless constructor defined for this object" came up.

I've found some threads about this on the net - like this one (http://www.telerik.com/forums/binding-to-an-arraylist-4539b158237a) - which are talking about the same error.
But the solution suggested in those are not satisfying, because I don't want to introduce a parameterless constructor if I don't need one (beside of Kendo).

Is there a way to use Kendo without having parameterless constructors?

Thanks in advance.

Kind regards
Daniel
Petur Subev
Telerik team
 answered on 18 Apr 2014
2 answers
136 views
Is Kendo 2014.1.415 not yet in cdn?
I am getting errors when attempting to use the latest version.
Vladimir Iliev
Telerik team
 answered on 18 Apr 2014
4 answers
736 views
Hi,

I have a stored procedure which returns  2 result sets. First result-set is collection of Columns ,data types, column order, Is column sortable and is column filterable. 
Second resultset is actual data for the columns which are there in first resultset. So in short my stored procedure returns the metadata for the columns and their values. I dont know in advance what will be my columns list. At code level stored procedure is  returning a dataset with 2 tables inside it.  Now I want to bind the kendo grid with the second table of dataset and first table of dataset will give me information about the columns which are suppose to have sort ,filter criteria. My problem is  i dont know the columns in advance still i execute the stored procedure then how can i use DataSourecRequest object to find out custom sorting and filtering stuff.
e.g. 
private CriteriaDto GetCriteriaDtoValues(DataSourceRequest request)
        {
           var criteriaDto = new DocumentHistoryCriteriaDto { Filters = new Dictionary<string, string>() };
            if (request.PageSize == 0)
            {
                request.PageSize = 20;
                criteriaDto.PageSize = 20;
            }
            else
            {
                criteriaDto.PageSize = request.PageSize;
            }
            if (request.Sorts != null && request.Sorts.Count > 0)
            {
                foreach (SortDescriptor sortDescriptor in request.Sorts)
                {
                    if (sortDescriptor.SortDirection == ListSortDirection.Ascending)
                    {
                        switch (sortDescriptor.Member)
                        {
                            case "ActivityDate": //This is hard coded column just for example but by this time i dont knwo what are the columns there in resultset
                                criteriaDto.SortBy = "ActivityDate";
                                criteriaDto.IsSortAcending = true;
                                currentSortType = criteriaDto.SortBy;
                                break;
                            case "RecordId": ////This is hard coded column just for example but by this time i dont knwo what are the columns there in resultset
                                criteriaDto.SortBy = "RecordId";
                                criteriaDto.IsSortAcending = true;
                                currentSortType = criteriaDto.SortBy;
                                break;                            
                        }
                    }
                    else
                    {
                        switch (sortDescriptor.Member)
                        {
                            case "ActivityDate": //This is hard coded column just for example but by this time i dont knwo what are the columns there in resultset
                                criteriaDto.SortBy = "ActivityDate";
                                criteriaDto.IsSortAcending = false;
                                currentSortType = criteriaDto.SortBy;
                                break;
                            case "RecordId": //This is hard coded column just for example but by this time i dont knwo what are the columns there in resultset
                                criteriaDto.SortBy = "RecordId";
                                criteriaDto.IsSortAcending = false;
                                currentSortType = criteriaDto.SortBy;
                                break;                            
                        }

                    }
                }
            }
            else
            {
                criteriaDto.SortBy = "ActivityDate"; //This is hard coded column just for example but by this time i dont know what are the columns there in resultset
                criteriaDto.IsSortAcending = true;
                currentSortType = criteriaDto.SortBy;
            }
            if (request.Filters != null && request.Filters.Count > 0)
            {
                foreach (FilterDescriptor filterDescriptor in request.Filters)
                {
                    switch (filterDescriptor.Member)
                    {
                        case "RecordId": //This is hard coded column just for example but by this time i dont know what are the columns there in resultset
                            criteriaDto.Filters.Add("LoanNo", filterDescriptor.Value.ToString());
                            break;
                    }

                }
            }
            if (request.Page > 0)
            {
                criteriaDto.PageNumber = request.Page;
            }
            return criteriaDto;

        }  

Also I have written below ajax method which is calling the above code before it calls the Store procedure. Can you provide some exmaple on how I can actually
pass the data set's data table collection to view in MVC  and How can i bind it to grid for 2nd table in dataset and how can i make use of first table
to decide which columns to sort and filter using DataSourceRequest object

 public ActionResult View_ByRecordId_Read([DataSourceRequest] DataSourceRequest request)
{
        
DataSet dsModel;
int  total=0;
int RecordId = 2;
string RecordValue = "0000224374";
 int timeFrame = 50;

 criteriaDto = this.GetCriteriaDtoValues(request);  //So here it calls this method to decide which columns got sort and filer criteria but actually by this time i dint get my procedure called so how can i figure it out which columns are meant to be for sorting and filtering.

dsModel = this._Service.GetDocumentView (userDto.Id,RecordId,RecordValue,timeFrame,criteriaDto,Guid.NewGuid());  //This is calling stored procedure and returning a dataset with 2 tables inside it.

if (dsModel != null && dsModel.Tables.Count > 0)        {
 bool tryParse=int.TryParse(dsModel.Tables[1].Rows[0]["TotalCount"].ToString(),out  total);    }

            var  result = new DataSourceResult() { Data = dsModel.Tables, Total = total };

            return Json(result);

        }
Aarti
Top achievements
Rank 1
 answered on 17 Apr 2014
1 answer
164 views

So I'm pretty new to using this component, so I'm not very familiar with it yet.

Here's what I'm trying to do:

I have a scheduler that I'm pre-populating with a lot of tasks.  I don't want the user to be able to add, delete, or update anything.  However, on selecting or clicking (or double clicking, whatever works best) I want to be able to update some other value in the model that was passed into the view.

For example: When user clicks on a task at 12:00 PM I don't want to show any pop ups or anything, but I want to set Model.appontmentTime equal to the tasks start time (i.e. 12:00 PM).

Also, as a side issue, for some reason when I attach a task to an owner as listed in the resources, the task is not showing in the right color.  Am I doing something wrong there?

So Far I have:

01.@(Html.Kendo().Scheduler<Humana.RetailSales.CGX.Site.TaskViewModel>()
02.            .Name("timeSlots")
03.            .Views(views => { views.WeekView(); })
04.            .Height(300)
05.            .Date(Model.appointmentCalendarRenderStartDate)
06.            .Height(400)
07.            .AllDaySlot(false)
08.            .MajorTick((int)Model.timeSlotInterval.TotalMinutes)
09.            .MinorTickCount(1)
10.            .Min(Model.appointmentCalendarRenderStartDate)
11.            .Max(Model.appointmentCalendarRenderFinishDate)
12.            .Resources(resource =>
13.            {
14.                resource.Add(m=> m.OwnerID)
15.                    .Title("Owner")
16.                    .DataTextField("Text")
17.                    .DataValueField("Value")
18.                    .DataColorField("Color")
19.                    .BindTo(new[] {
20.                        new { Text = "Many", Value = 1, color = "#003300"},
21.                        new { Text = "Few", Value = 2, color = "#CC3300"}
22.                    });
23.            })
24.            .DataSource(d => d
25.                .Model(m => {
26.                    m.Id(f => f.TaskID);
27.                    m.Field(f => f.Title).DefaultValue("No title");
28.                    m.Field(f => f.OwnerID).DefaultValue(1);
29.                    m.Field(f => f.Title).DefaultValue("No title");
30.                    m.RecurrenceId(f => f.RecurrenceID);
31.                })
32.
33.            )
Vladimir Iliev
Telerik team
 answered on 17 Apr 2014
3 answers
378 views
I am trying to pass data to the controller using MVC wrappers. But data not being send, controller is executing but data is not passed. am I doing things correctly?
Thanks

var chart = $("#SalesChart").data("kendoChart");
chart.refresh({
    data: { "FromDate": $("#FromDate").data("kendoDatePicker").value(), "ToDate": $("#ToDate").data("kendoDatePicker").value() }
});

​
@code
           Dim SalesChart As Kendo.Mvc.UI.Chart(Of BO.Models.Statistics.SalesTimeSpan) = _
               Html.Kendo.Chart(Of BO.Models.Statistics.SalesTimeSpan).
               Name("SalesChart").Title("Units sold").Series(Sub(series)
                                                                     series.Line(Function(model) model.Value, categoryExpression:=Function(model) model.Period).
                                                                     Aggregate(ChartSeriesAggregate.Avg)
                                                             End Sub).
           CategoryAxis(Function(axis) axis.Date().BaseUnit(ChartAxisBaseUnit.Weeks)).
           DataSource(Function(ds) ds.Read(Function(read) read.Action("getsalesbydate", "statistics", New With {.area = String.Empty})))
 
           SalesChart.Render()
 
 
       End Code
Daniel
Telerik team
 answered on 17 Apr 2014
2 answers
583 views
This bug is fixed with the internal build: kendoui.aspnetmvc.internal.2013.3.1321.commercial !

Hi kendo support team,

i have updated my Kendo Version yesterday to the new "Kendo UI for ASP.NET MVC Q3 2013" Release.

Now my Scheduler works with additional parameters they will calculate on runtime.
The user click some btns and the Scheduler refresh the data by call JavaScript method read()

like this:
01.var initialMitarbeiterId =5;
02.var filterKategorieArray = new Array();
03. 
04.function SchedulerAdditionalData() {
05.    return { mitarbeiterId: initialMitarbeiterId, filterKategorien: filterKategorieArray.toString() };
06.}
07. 
08.function SchedulerReadData() {
09.    var scheduler = $("#ErfassungScheduler").data("kendoScheduler");
10.    scheduler.dataSource.read();
11.}
the Scheduler code in razor Logik Looks like this:

01.@(Html.Kendo().Scheduler<Sachverhalt>()
02.          .Name("ErfassungScheduler")
03.          .Date(DateTime.Now)
04.          .Views(views =>
05.          {
06.              views.DayView(oDayView => oDayView.DateHeaderTemplate("#=kendo.toString(date, 'ddd dd. MM.')#").Selected(false));
07.              views.WeekView(oWeekView => oWeekView.DateHeaderTemplate("#=kendo.toString(date, 'ddd dd. MM.')#").Selected(false));
08.              views.MonthView(oMonthView => oMonthView.Selected(true));
09.              views.AgendaView(oAgendaView => oAgendaView.Selected(false));
10. 
11.          })
12.          .Selectable(true)
13.          .Timezone(timezoneString)
14.          .DataSource(oDs => oDs.Model(m =>
15.              {
16.                  m.Id(f => f.Id);
17.                  m.Field(f => f.IsAllDay);
18.                  m.Field(f => f.Title).DefaultValue("Neuer Termin");
19.                  m.Field(f => f.SachverhaltKategorieId);
20.                  m.Field(f => f.SachverhaltTypId);
21.              })
22.             .Read( r => r.Action("SchedulerRead", "Erfassung").Data("SchedulerAdditionalData"))
23.        .Destroy("SchedulerDestroy", "Erfassung")
24.             )
25.          .Events(e => e.Edit("scheduler_edit").Add("scheduler_add").Navigate("scheduler_navigate"))
26.          .Resources(resource =>
27.              resource.Add(m => m.SachverhaltKategorieId)
28.                .Title("Kategorie")
29.                .DataTextField("Text")
30.                .DataValueField("Value")
31.                .DataColorField("Color")
32.                .BindTo(colorResourceList)
33.          )
34.          .ShowWorkHours(true)
35. )

The Controller Methode

1.[HttpPost]
2.public JsonResult SchedulerRead([DataSourceRequest] DataSourceRequest oRequest, long mitarbeiterId, string filterKategorien)
3.{
4.            var selectedMitarbeiterId = mitarbeiterId;
5.            return Json(this.sachverhaltBL.LoadSachverhalte(selectedMitarbeiterId, filterKategorien).ToDataSourceResult(oRequest));
6.}

This line .Read( r => r.Action("SchedulerRead", "Erfassung").Data("SchedulerAdditionalData")) works fine with the previous Version. The JavaScript function "SchedulerAdditionalData" is called before post to Controller, but the Controller throws a http Status 500 because mitarbeiterId is null. In the previus Version it works correct, Did Kendo have Changed something in this Version. The release notes don't talk about this Problem.

If i change the JavaScript file "kendo.aspnetmvc.min.js" to the privious Version only, this Scenario works fine! I think there is a new bug in the js libraray.

Best regards

Gerd Kontze

Daniel
Telerik team
 answered on 17 Apr 2014
1 answer
459 views
Hi,

I'm trying to use a Kendo Grid inside a field template to handle the edit of a list of objects define as a property of another object using the UIHintAttribute.
The problem that I have is when you click the edit on the grid the values are not set to the editor controls they are all empty.

I have attached the relevant files from my test project and would appreciate any help.

Thanks, 
Vladimir Iliev
Telerik team
 answered on 17 Apr 2014
2 answers
199 views
Hello,

I created a grid using the example provided herehere and here.

When I click on any cell to edit it, the following error is triggered. Any help?

Uncaught TypeError: undefined is not a function         kendo.all.min.js:9
O                                       kendo.all.min.js:9
D                                       kendo.all.min.js:9
e.extend.kendoFocusable                 kendo.all.min.js:10
Sizzle.selectors.filter.PSEUDO          jquery-1.7.1.js:4605
Sizzle.filter                           jquery-1.7.1.js:4127
Sizzle                                  jquery-1.7.1.js:3955
Sizzle                                  jquery-1.7.1.js:5083
jQuery.fn.extend.find                   jquery-1.7.1.js:5339
u.extend.refresh                        kendo.all.min.js:20
u.extend.init                           kendo.all.min.js:20
(anonymous function)                    kendo.all.min.js:10
jQuery.extend.each                      jquery-1.7.1.js:658
jQuery.fn.jQuery.each                   jquery-1.7.1.js:271
e.fn.(anonymous function)               kendo.all.min.js:10
j.extend.editCell                       kendo.all.min.js:22
(anonymous function)                    kendo.all.min.js:22
jQuery.event.dispatch                   jquery-1.7.1.js:3256
elemData.handle.eventHandle             jquery-1.7.1.js:2875

The grid has the following code:

@(Html.Kendo().Grid<Kendo2.Models.Product>()
    .Name("grid")
    .Columns(c =>
        {
            c.Bound(b => b.Id).Hidden();
            c.Bound(b => b.Name);
            c.Bound(b => b.Company);
        }
    )
    .Editable(e => e.Mode(GridEditMode.InCell))
    .Sortable()
    .Pageable(p => p
        .Refresh(true)
        .PageSizes(new int[] {2, 10})
        .ButtonCount(5)
    )
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(m => m.Id))
        .Read(read => read.Action("List", "Home"))
    )
)

Alexander Popov
Telerik team
 answered on 17 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?