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

When I have the data source CRUD set in the Razor version of the Scheduler control AND I define events for Save and Remove the call to the Read and Destroy calls are duplicated.

Is this the correct behavior?

01.<input type="hidden" id="scheduleID" required data-required-msg="Please select a schedule."/>
02. 
03.@(Html.Kendo().Scheduler<DOTTReportsWebViewer.Models.TaskViewModel>()
04.    .Name("scheduler")
05.    .Editable(e=>e
06.                .Confirmation(false)
07.                .Update(false)
08.                .Resize(false)
09.     )
10.    .Date(DateTime.Now)
11.    .StartTime(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, 00, 00))
12.    .Views(views =>
13.    {
14.        views.DayView();
15.        views.WeekView(weekView => weekView.Selected(true));
16.        views.MonthView();
17.        views.AgendaView();
18.    })
19.    .Timezone("Etc/UTC")
20.    .DataSource(d => d
21.        .Model(m => {
22.            m.Id(f => f.TaskID);
23.            m.Field(f => f.OwnerID).DefaultValue(1);
24.        })
25.         
26.        .Read("Tasks_Read", "Subscriptions")
27.        .Create("Tasks_Create", "Subscriptions")
28.        .Destroy("Tasks_Destroy", "Subscriptions")
29.        .Update("Tasks_Update", "Subscriptions")
30.         
31.    )
32.    .Events(events => events
33.            .Save("scheduler_save")
34.            .Remove("scheduler_remove")
35.            )
36.     
37.     
38.)
39.     
40. 
41.<script type="text/javascript">
42.    
43.    function scheduler_save(e) {
44.        
45.        var scheduler = $("#scheduler").data("kendoScheduler");
46.         
47.        if ($("#scheduleID").val() != '') {
48.            scheduler.removeEvent($("#scheduleID").val());
49.        }
50.        $("#scheduleID").val(e.event.uid);
51.    }
52.     
53.    function scheduler_remove(e) {
54.        $("#scheduleID").val('');
55.         
56.    }
57. 
58.</script>

Rosen
Telerik team
 answered on 28 Nov 2013
1 answer
196 views
Hi,

I’ve following method which I’m using to build data source
for Kendo UI grid. I want to set default page number like default page size but
I can’t see an option in DataSourceBuilder.

Any idea?

public static Action<DataSourceBuilder<T>>DataSourcer<T>(string action, string controller, int total, string area, string jsParamFuncName = "",
int? defaultPageSize = null)     
where T : class 
{
if
(!defaultPageSize.HasValue)
defaultPageSize = int.Parse(ApplicationConfigurationDataHelper.GetByKey(ApplicationConfigurationConstants.DefaultPageSize).Value);
  
return
dataSource => dataSource.Ajax().Read(read =>  {                            
read.Action(action,
controller, new { area });                       
if (!string.IsNullOrEmpty(jsParamFuncName))                                                
{
      read.Data(d => jsParamFuncName);                                                
}                              
}) .Total(total)                        
.PageSize(defaultPageSize.Value)                    
.Events(e => e.Change(JsFunctionNameConstants.EmptyGridMessage));
}
Vladimir Iliev
Telerik team
 answered on 28 Nov 2013
3 answers
232 views
Greetings,

I would like to extend a Kendo.Mvc.UI.Fluent builder in my own html helper method and would like to know the easiest way to do this. To use a very simple scenario, I have many @Kendo.Button components that optionally need to be hidden. Until now I have created HtmlHelper functions and send in my custom parameters for various controls. I would like to start extending the WidgetBuilder itself.

For example is something like this easy to accomplish:

public class MyButtonBuilder : Kendo.Mvc.UI.Fluent.ButtonBuilder
{
    public bool Visible { get; set; }
     
    public override void Render()
    {
        if(Visible==false)
            //Do something to return empty HTML
        else
            base.Render();
    }
}



Thanks
Atanas Korchev
Telerik team
 answered on 27 Nov 2013
1 answer
1.3K+ views
Hi,

I've read several posts (stackoverflow, kendo forums, ...), but I don't find a 100% effective solution for my scenario. My team is facing a performance problem with our current code to filter/sort/group/... records in the Kendo Grid, this is a simple example of one of our possible flows:

MVC Controller Action:
[HttpPost]
public ActionResult Read([DataSourceRequest] DataSourceRequest request)
{
    // userService uses a client to call WebAPI action
    var usersList = this.userService.UsersList;
      
    var dataSource = usersList.ToDataSourceResult(request);
    return this.Json(dataSource, JsonRequestBehavior.AllowGet);
}
Client Action:
public UserResponseDto Users()
{
    var requestUri = this.ApiRequestUri("/User/User/Get/");
    var response = this.GetAs<UserResponseDto>(requestUri);
    return response;
}
WebAPI Controller Action:
[HttpGet]
public UserResponseDto Get()
{
    var result = this.userService.GetUsers(null);
    var response = new UserResponseDto { Users = result };
    return response;
}
The Repository:
public IEnumerable<UserDto> Users(UserRequestDto userRequestDto)
{
    // calls an store procedure and retrieves data as DTO
    var parameters = new[]
           {
          SqlHelper.BuildParameter(SqlDbType.VarChar, "@sUserId", ParameterDirection.Input, userRequestDto.UserId)
   };
  
    using (var sqlAccess = this.sqlAccessFactory.Invoke(//some parameters))
    {
        var collectionPocos =
            sqlAccess.ExecProcedureEntity<UserPoco>(
                "SVC_GetUser", parameters.ToArray(), true);
  
        return
            collectionPocos.Select(
                sp =>
                new UserDto
                {
                    // Fill the properties
                });
    }
}

As you can see we’re getting all the records from API and then we use this Kendo function “ToDataSourceResult” that makes all the logic and show just required records in the grid. 

The problem is that there are some cases where the data set has (bi)millions of records, fetching all of the rows is a very expensive process, so we're trying to do the filtering, sorting, grouping,.. in the stored procedure to reduce the amount of data per request. As a team we discussed of possible solutions:
  • Create a functionality to get from the Kendo DataSourceRequest object (filters, sorting, page,…) and dynamically build the request and send them to the WebAPI. 
  • Build the where clause based on the filters that we have and send it as parameter to the SP, like in this post.
  • Use OData (according this article Kendo UI MVC Wrappers doesnt support OData)
Does anybody could provide me some guidance if this is a known issue, if there is a workaround or solution?

Some extra information of our System:
  • It's a N-Tier application
  • MVC is used for the front-end tier
  • All the Data Base calls must be done using Stored Procedures
  • The WebAPI is the one that calls the stored procedures
  • In future all the tiers will be placed in different servers, probably with different firewall configurations (so, the idea is to minimize the size of data that travels between them)
  • Application uses the Kendo UI MVC Wrappers 
  • There's a custom solution to apply our metadata in the Kendo Wrapper, so instead of this code
@(
    Html.Kendo().Grid<User>()
        .Name("UsersList")
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Read", "User"))
        )
        .Scrollable(s => s.Virtual(true).Enabled(true))
)
we have this:
@(
    Html.Flex().GridFor(m => m.UsersList, "Id", "Read", "User")
)

Some links:

http://stackoverflow.com/questions/15843703/kendo-mvc-todatasourceresult-extremly-slow-with-large-iqueryable
http://www.kendoui.com/forums/kendo-ui-web/grid/handle-filter-generated-parameters-on-server-side-for-a-grid-serverfiltering-true.aspx
http://stackoverflow.com/questions/13738249/get-paging-filtering-from-telerik-extension-grid-and-pass-to-stored-procedure
http://www.telerik.com/community/forums/aspnet-mvc/grid/best-approach-for-large-amounts-of-data.aspx
http://blogs.msdn.com/b/webdev/archive/2013/02/25/translating-odata-queries-to-hql.aspx


Thanks in advance,
Petur Subev
Telerik team
 answered on 27 Nov 2013
1 answer
108 views
Hi,

This is probably a very easy answer but after the update to 2013.3.1119 the menu is rendering a horizontal and vertical scroll bar on each child menu item and the width of the child menu is locked to the top menu item. All the top menu items looks fine. If the child menu has an inner child menu item the menu also rendered correctly. We are stuck on IE8 at the moment. Any ideas how this can be corrected?

Rob 
Dimo
Telerik team
 answered on 27 Nov 2013
5 answers
744 views
Hi!

I am trying to start a kendo mvc project with VS extension. However, when I use the wizard, it fails and I get this error:

An error occured while running the wizard.

Error executing custom action Telerik.KendoUI.Mvc.VSX.Actions.CopyResourcesAction: System.IO.FileLoadException: Could not load file or assembly 'Kendo.Mvc, Version=2013.2.716.340, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. The keyset is not defined. (Exception from HRESULT: 0x80090019)
File name: 'Kendo.Mvc, Version=2013.2.716.340, Culture=neutral, PublicKeyToken=121fae78165ba3d4' ---> System.Runtime.InteropServices.COMException (0x80090019): The keyset is not defined. (Exception from HRESULT: 0x80090019)
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Telerik.KendoUI.Mvc.VSX.Actions.CopyResourcesAction.GetKendoVersionedFolder(String mainAssemblyLoadInfo)
   at Telerik.KendoUI.Mvc.VSX.Actions.CopyResourcesAction.ModifyResources()
   at Telerik.KendoUI.Mvc.VSX.Actions.CopyResourcesAction.Execute(WizardContext wizardContext, IPropertyDataDictionary arguments, IProjectWrap project)
   at Telerik.VSX.Actions.ProjectActionBase.Execute(WizardContext wizardContext, IPropertyDataDictionary arguments)
   at Telerik.VSX.WizardEngine.Actions.ActionBase.Telerik.WizardFramework.IAction.Execute(IWizardContext wizardContext, IPropertyDataDictionary arguments)
   at Telerik.VSX.WizardEngine.ActionManager.ExecActions()

Does anyone know what it is happening?

Thanks!
Rick Hubka
Top achievements
Rank 1
 answered on 26 Nov 2013
5 answers
1.5K+ views
I've got a view with a kendo grid on it.  Above that I have a partial view that loads a value and stores it in a hidden.  I need to be able to pass the value of this hidden field to the get, add, update, and delete methods of the grid preferably without having to load the grid via jquery (if possible).

Or is there a way that the hidden field on the view could be accessible or passed to the editortemplate for the grid so that I can make it part of the view model when a row is added or updated?

Here is the main view:
@model IEnumerable<PASSAdmin.ViewModels.UserFacilityAdmin.ProposalTypeViewModel>
 
@{
    ViewBag.Title = "Proposal Types";
}
 
<h2>Proposal Types</h2>
 
@Html.Partial("_LastViewedUserFacility")
 
@{    
    Html.Kendo().Grid(Model)
    .Name("gridProposalTypes")
    .Columns(columns =>
    {
        columns.Command(command => { command.Edit(); }).Width(50);
        columns.Bound(o => o.Code);
        columns.Bound(o => o.Description);
        columns.Bound(o => o.Technique_Selection_Count).Title("# Techniques");
        columns.Bound(o => o.Resource_Selection_Count).Title("# Resources");
        columns.Bound(o => o.Selection_Order).Title("Selection Order");       
        columns.Bound(o => o.Active);
        columns.Command(command => { command.Destroy(); }).Width(50);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("UserFacilityAdmin/ProposalType").Window(window => window.Width(400)))
    .Pageable()
    .Sortable()
    .DataSource(dataSource => dataSource
        .Server()
        .Model(model => model.Id(o => o.ID))
        .Create(create => create.Action("AddProposalType", "UserFacilityAdmin"))
        .Read(read => read.Action("ProposalTypes", "UserFacilityAdmin"))
        .Update(update => update.Action("UpdateProposalType", "UserFacilityAdmin"))
        .Destroy(destroy => destroy.Action("DeleteProposalType", "UserFacilityAdmin"))
    )
    .Render();
}
Here is the partial view loaded above the grid:
<p>User Facility: <span id="userfacility"></span></p>
 
<input type="hidden" name="User_Facility_ID" id="User_Facility_ID" />
 
<script type="text/javascript">
$(document).ready(function () {
    $.post('/Search/GetLastViewedUserFacilityID', function (data) {
        $("#userfacility").html(data);
        $("#User_Facility_ID").val(data);
    });
});
</script>
The "User_Facility_ID" is the value I need when doing the get, add, update, and delete for the grid.





Petur Subev
Telerik team
 answered on 26 Nov 2013
3 answers
213 views
On a ASP.NET MVC UI, I need to expose multiple input controls (list, multiselect, date controls) on the top and a grid in the bottom.
The grid will be filtered based upon the values selected (with list selection resulting in OR condition, multi-select selections resulting in AND condition and so on) and with their own column filters
I am currently writing a Big ViewModel which will have a collection of the list, multi-select items and then a collection to support grid rows which change according to the filters above.
On a submit button, all the filters (from the list/multiselect controls + the grid column filters) should all filter the grid rows at once.
All my UI widgets are Kendo UI widgets. I am using the MVC wrapper.
Question is : Where do I store the selections the user makes ? I don't want to use any comma-separated logic. I want the VM to be filled with actual selections on post so that I apply the filters on the grid and return the JSONresult?

I am just not able to get the ViewModel and view synced properly.
Vladimir Iliev
Telerik team
 answered on 26 Nov 2013
2 answers
70 views
I want to implement a custom routine that is triggered by a button on a pop-up editor, from a grid.

The routine needs to be passed values that the user has entered into the form (but before the form has been submitted) .  How can I obtain these values from a function called from a buttons onclick handler?

I know that its possible to reference controls from the grids edit event, using the e.container object, but how do I do this outside of the edit event?

e.g:-  I have a text box defined:-
<p>  <span class="fieldlabel2">
           Target Table:
        </span>
 
            @Html.TextBoxFor(c => c.TargetTable, new { style = "width:200px", Maxlength = 50 })
            @Html.ValidationMessageFor(c => c.TargetTable)
          
</p>
How can I get the value typed into this from a function (not the edit event handler)?
AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 26 Nov 2013
1 answer
114 views
I am doing drag and drop from one listview to another and everything is working great except on a tablet - the drop point seems to not work correctly (wrong x,y coordinates?)

I am not using the Kendo mobile listview - it's a std kendo mvc listview.

On desktops - the drop is great.

Any info on this?

Thanks,

Rene.
Nikolay Rusev
Telerik team
 answered on 26 Nov 2013
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
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
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?