Telerik Forums
UI for ASP.NET MVC Forum
1 answer
110 views
I know this may be outside the scope of things here. 

I have a telerik Ajax.net website that is used in a similar way to the likes of wetransfer.com 

after a a recent pen test the security guys were able to get around the filters in place and spoof some files onto the server and gain remote access. 

Obviously not a good thing. So the site has been taken off line, 

I was looking to upgrade the site using kendo and was wondering if you had any advice on how I can try and prevent this sort of tampering or point me in the right direction to try and secure the site. 

The site is a great idea for helping transfer large files to groups of people and getting past email restrictions so any ideas would be greatly received. 

Dimiter Madjarov
Telerik team
 answered on 02 Dec 2013
1 answer
701 views
Hi

Is it possible to configure the Treeview checkboxes so that when a node's children are all deselected, the node is not deselected also? I need the CheckChildren functionality turned on so that children are automatically selected when their parent is. But I don't want the parent removed from the selection when its children are unchecked.

To illustrate I have set up a jsbin . I'd like to be able to select nodes a, b1 and b2. However b2 only shows checked when any of c1, c2 and c3 are checked. I can use CheckChildren(false) to allow selection of b1 and b2 individually, but I have much more data than this example so manually checking all the nodes would become too much for the user.

Here is how I am currently placing the treeview on the page (Model.Items is a list of TreeViewItemModel instances):

@Html.Kendo().TreeView().Name("treeview").BindTo(Model.Items).ExpandAll(true).Checkboxes(c => c
        .Enabled(true)        
        .CheckChildren(true)
        )

Any thoughts?
Petur Subev
Telerik team
 answered on 02 Dec 2013
1 answer
451 views
Hi,

I have a grid which is displaying a custom styled template looking like this with kendo default theme installed (See "fleetlist-kendo-default.PNG")
At this point the following is installed:
<link rel="stylesheet" href="@Url.Content("~/Content/Kendo/kendo.common.min.css")">
<link rel="stylesheet" href="@Url.Content("~/Content/Kendo/kendo.default.min.css")">
However, when I change the theme to Bootstrap so that it can match the rest of my Bootstrap-themed application (Bootstrap 3.x) the template and its styling seems to get overriden (See "fleetlist-kendo-bootstrap.PNG")
At this point the following is installed:
<link rel="stylesheet" href="@Url.Content("~/Content/Kendo/kendo.common-bootstrap.min.css")">
<link rel="stylesheet" href="@Url.Content("~/Content/Kendo/kendo.bootstrap.min.css")"/>
On the other hand, if I apply the flat theme, it works again.
What can I do? :)

Regards,
Nicklas
Dimo
Telerik team
 answered on 29 Nov 2013
1 answer
434 views
On page load we build a grid based on a DataTable model, we have a for each loop to generate the columns. Then from a kendo dropdown list we select a new ID which on selection, fires the dataSource.read method, passing the new ID. This returns a different dataset with different columns. The grid refreshes and shows the correct number of items/rows but the old columns remain and the grid is empty. The grid is not displaying the new columns.

I have tried to destroy and empty the grid before dataSource.read but then get a dataSource is undefined console error. See setup code below:

Grid:
@(Html.Kendo().Grid(Model)
    .Name("Grid")
    .Columns(columns =>
    {
        foreach (System.Data.DataColumn column in Model.Columns)
        {
            columns.Bound(column.ColumnName).Hidden(column.ColumnName == "CustID").Title(column.ColumnName.ToString().Replace(" ", ""));
        }
        columns.Bound("CustID").Title("").ClientTemplate("<a href='/Customers/Customer/#: CustID #'>More Details</a>");
    })
    .Pageable()
    .Sortable()
    .Filterable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(15)
        .ServerOperation(false)
        .Model(model =>
            {
                foreach (System.Data.DataColumn column in Model.Columns)
                {
                    model.Field(column.ColumnName, column.DataType);
                }
            })
        .Read(read => read.Action("CustomerDataRead", "Customers", new { _CustomerListID = 18 }))
    )
)
The dropdown list select function:
function select(e) {
    var dataItem = this.dataItem(e.item.index());
    if (dataItem.CustomerListID == "") {dataItem.CustomerListID = -1}
    //$('#Grid').data().kendoGrid.destroy();
    //$('#Grid').empty();
    $("#Grid").data("kendoGrid").dataSource.read({ _CustomerListID: dataItem.CustomerListID});
}
In the select event above, I pass the ID to the read method. 

The grid refreshes, but the old columns do not update but the number of items returns is correct. See this screenshot:
http://prntscr.com/26yio5

If the dataset returned by dataSource.read has the same columns as the original grid, the grid refreshes OK and the data is displayed.

If I destroy and empty the grid, the dataSource.read method fails:
"Uncaught TypeError: Cannot read property 'dataSource' of undefined "

How to update the grid with new columns in each subsequent dataSource.read






Daniel
Telerik team
 answered on 29 Nov 2013
1 answer
85 views
Can't tab to focus the content pane of an editor generated by a client side template
Dimiter Madjarov
Telerik team
 answered on 29 Nov 2013
1 answer
423 views
Hello,

I have Kendo selectable Grid being created in razor.
After row is selected user can delete the selected row. But since the grid has multiple pages, after deletion -  reloading contents of data I need the selection to be put on the next row, preserving the current page number...

How can I achieve that?

Thank you for your prompt answer.

Shabtai
Dimiter Madjarov
Telerik team
 answered on 28 Nov 2013
1 answer
121 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
186 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
212 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?