Telerik Forums
UI for ASP.NET MVC Forum
5 answers
427 views

I am fairly new to kendo UI and very new to MVC. We have an application written in kendo UI. I am concerned about the potential volume of data being transferred to the client side as datasets grow. I am thinking of making some of our current application MVC based if we can gain greater control over paging through grids.

1) With kendo UI is it the case that the page brings back the whole result set, and then paging through is managed locally client side within the page?

2) With MVC version of the grid is the data bound server side or is the whole dataset delivered to the browser and paging managed as per (1). Does this limit the amount the data transferred from server to client?

3) With MVC version is there any mechanism that allows the paging to occur within the SQL statement to restrict the size of the result turned from the database server?

 

Any pointers with this would be appreciated.

 

Alexander Popov
Telerik team
 answered on 18 Oct 2016
3 answers
499 views
I am currently using the multi select for the first time and am encountering a problem with the scenario I am using.

I have the following cshtml page: ​

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
 
<h2>Index</h2>
 
@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
 
    @(Html.Kendo().Grid<InclusionManagerMVC.Models.HouseModels.HouseModel>()
.Name("HouseGrid")
    .HtmlAttributes(new { style = "height:600px;" })
.ToolBar(toolbar =>
{
    toolbar.Create();
})
.Columns(columns =>
{
    columns.Bound(c => c.ID).Visible(false);
    columns.Bound(c => c.Name).Title("House Name");
    columns.Bound(c => c.TooltipText).Title("Description");
    columns.Bound(c => c.Active).Title("Enabled");
 
    columns.Command(c => c.Edit());
})
.Editable(edit =>
{
    edit.TemplateName("HouseModel").Mode(GridEditMode.PopUp);
})
.DataSource(datasource =>
{
    datasource.Ajax()
        .Create(create => create.Action("Create_House", "Houses", new { area = "Administration" }).Data("sendAntiForgery"))
        .Read(read => read.Action("Read_House", "Houses", new { area = "Administration" }))
        .Update(update => update.Action("Update_House", "Houses", new { area = "Administration" }).Data("sendAntiForgery"))
        .Model(model =>
        {
            model.Id(field => field.ID);
            model.Field(field => field.ID).DefaultValue(Guid.NewGuid());
            model.Field(field => field.Name);
 
            model.Field(field => field.Active).DefaultValue(true);
            model.Field(field => field.TooltipText).DefaultValue(string.Empty);
            model.Field(field => field.SchoolsIdList).DefaultValue(new List<InclusionManagerMVC.Models.SchoolModels.SchoolsModel>());
            model.Field(field => field.TenantIdList).DefaultValue(new List<InclusionManagerMVC.Models.TenantModels.TenantsModel>());
        })
        .Events(events => events.Error("error_handler"));
 
 
})
.Pageable(page => page.PageSizes(new int[] { 10, 20, 50, 100, 250, 1000 }).Refresh(true))
.Sortable()
.Groupable()
.Filterable()
.Scrollable()
.ColumnMenu()
    )
}
 
<script type="text/javascript">
    function tenantsfilter()
    {
        var multiSelect = $("#TenantIdList").data("kendoMultiSelect");
        var values = multiSelect.value($("#value").val());
        console.log(values.length);
         
        return { tenants: values.toString() };
 
    }
 
    function refresh_multiSelect(e)
    {
        console.log(e);
 
        $("#SchoolsIdList").data("kendoMultiSelect").dataSource.read();
        
    }
 
</script>


I am then using this editor on the screen:
@model InclusionManagerMVC.Models.HouseModels.HouseModel
 
 
@Html.HiddenFor(m => m.ID)
 
 
<div class="form-horizontal" role="form" style="padding:10px;">
    <div class="form-group">
        @Html.LabelFor(m => m.Name, new { @class = "form-label col-lg-2" })
        <div class="col-lg-6">
            @Html.TextBoxFor(m => m.Name, new { @class = "form-control", placeholder = "Enter name of the house" })
        </div>
    </div>
 
    <div class="form-group">
        @Html.LabelFor(m => m.TooltipText, new { @class = "form-label col-lg-2" })
        <div class="col-lg-6">
            @Html.TextAreaFor(m => m.TooltipText, new { @class = "form-control", placeholder = "Enter a description about this house" })
        </div>
    </div>
 
    <div class="form-group">
        @Html.LabelFor(m => m.Active, new { @class = "form-label col-lg-2" })
        <div class="col-lg-6">
            @Html.CheckBoxFor(m => m.Active)
        </div>
    </div>
 
    <div class="form-group">
         @Html.LabelFor(m => m.TenantIdList, new { @class = "form-label col-lg-2" })
        <div class="col-lg-6">
            @(
                Html.Kendo().MultiSelectFor(m => m.TenantIdList)
                .DataTextField("Name")
                .DataValueField("ID")
                .DataSource(datasource =>
                {
                    datasource.Read(read => read.Action("GetTenants", "Houses", new { area = "Administration" }));
                })
                .Placeholder("Select School Groups")
                .IgnoreCase(true)
                .HighlightFirst(true)
             )
        </div>
    </div>
 
 
    <div class="form-group">
        @Html.LabelFor(m => m.SchoolsIdList, new { @class = "form-label col-lg-2" })
        <div class="col-lg-8">
            @(
 Html.Kendo().MultiSelectFor(m => m.SchoolsIdList)
                .DataTextField("Name")
                .DataValueField("ID")
                .AutoBind(false)
                 
                .DataSource(datasource =>
                {
                    datasource.Read(read => read.Action("GetSchools", "Houses", new { area = "Administration" })
                        .Data("tenantsfilter"))
                        .ServerFiltering(true)
                        .Events(events => events.Error("error_handler").Change("refresh_multiSelect"));
                })
                .Placeholder("Select Schools")
                .IgnoreCase(true)
                .HighlightFirst(true)
                .ItemTemplate("<span class=\"label label-info\">#: data.Name#</span><span class=\"label label-default\">(#:data.TenantName#)</span> ")
            )
        </div>
    </div>
 
 
 
 
 
    @Html.Partial("_ErrorPanel")
</div>


This then calls the appropriate controller below:


public JsonResult Read_House([DataSourceRequest] DataSourceRequest request)
       {
           this.Response.Cache.SetCacheability(HttpCacheability.NoCache);
           List<HouseModel> model = new List<HouseModel>();
           try
           {
               model = houseSvc.GetHousesList();
           }
           catch (Exception error)
           {
               throw error;
           }
 
           return Json(model.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
 
       }
 
 
       public JsonResult GetTenants()
       {
           this.Response.Cache.SetCacheability(HttpCacheability.NoCache);
           List<TenantsModel> model = tenantSvc.GetTenantsList(true);
            
           return Json(model, JsonRequestBehavior.AllowGet);
 
       }
 
       public JsonResult GetSchools(string tenants)
       {
           this.Response.Cache.SetCacheability(HttpCacheability.NoCache);
           List<string> tenantStringList = tenants.Split(',').ToList();
 
           List<TenantsModel> tenants2 = tenantSvc.GetTenantsList(true, tenantStringList);
 
            
 
 
            
           List<SchoolsModel> model = schoolSvc.GetSchoolsList(true, tenants2);
 
 
 
 
           return Json(model, JsonRequestBehavior.AllowGet);
 
       }

So when I go to my editor and select the first multiselect item I get the drop down option but when I select the second one the change event is constantly firing.

I know it is because of the datasource.read() action being performed which is causing this but how do I prevent this.


What I need to be able to do is select the values in the first multi-select (tenantsIdList) and then it rebind the options back to the SchoolsIdList with the found values.

In addition to this I need to be able to remove items from the (SchoolsIdList) if the corresponding (tenantsIdList) is removed.

For example in the tenants options we have

Tenant 1
Tenant 2
Tenant 3
.....



In the schools list we have

School 1 (which is associated with Tenant 1)
School 2 (which is associated with Tenant 2)
School 3 (which is associated with Tenant 3)
.......

So if I select "Tenant 1" in the first multi select I would only see "School 1" in the second multi select

if I then selected "Tenant 2" in the first multi select I would now see School 1 and School 2.

But then if I de-selected "Tenant 1" I would only want School 2 to be available in addition if School 1 had been selected as a value then this should be removed from the list of selected values.

Any assistance would be greatly received.





Jason
Top achievements
Rank 2
 answered on 18 Oct 2016
2 answers
196 views
For the 2016.3.914 release, I tried using the Dashboard project template, since I have to start thinking of building a dashboard at work, but upon running it, I just get a bunch of 500 errors on all the CSS and JS files...  Does this project template not work out of the box?  What do I need to do to get it to work?
Joe
Top achievements
Rank 1
 answered on 17 Oct 2016
2 answers
381 views

Hi,

Just a generic question: how to pass grid data back to controller. I tried to search a bit. Look like it needs to use ajax but I am not sure how it works exactly. Do you have a simple sample code? The link to some old sample code is not valid anymore.

Thanks

Tong

Konstantin Dikov
Telerik team
 answered on 17 Oct 2016
1 answer
116 views

I need to make a custom week layout for a Scheduler

see image

 

Peter Milchev
Telerik team
 answered on 17 Oct 2016
7 answers
507 views

Is there a way to build a GridState from server-side code?

 

We want to be able to set up the grid in a specific based on certain filters that are in a database. As far as I can tell the only way I could do that now is to look at how the structure of the JSON object is formed and create my own JSON object Grid State constructor based on that. But I don't like that idea because the structure could change with time, or there might be small things that I miss.

I'm looking for something along the lines of this:

GridState gs = new GridState();

gs.addFilter("columnName","filterText", columnWidth, showColumn, ..., .., )

 

Does anything like this exist?

Vladimir Iliev
Telerik team
 answered on 17 Oct 2016
1 answer
275 views

Hello,

 

We need to install version 2011.3.1305.40 What is the download link?

Thank you


Dyanko
Telerik team
 answered on 14 Oct 2016
2 answers
138 views

 

 

I can't seem to figure out why my grid doesn't show data. Here's the Contoller code:

public JsonResult PopulateGrid()
{
var x = (from n in dbContext1.GetOrders("Melody Devoe") select n);
List<string> items = new List<string>();
foreach (var item in x)
{
items.Add(item.ToString());
}

return Json(items.ToList(), JsonRequestBehavior.AllowGet);

}

 

Here's the cshtml:

<div class="a">
@(Html.Kendo().Grid<CentralBilling.Models.GetOrders_Result>()
.Name("gridRater")
.DataSource(datasource => datasource
.Ajax()
.Read(read => read.Action("PopulateGrid", "Home")))
.Columns(columns =>
{
columns.Bound(o => o.Order_Number);
//columns.Bound(o => o.ActDate);
//columns.Bound(o => o.Agent_Role);
//columns.Bound(o => o.aom_shipment_type);
//columns.Bound(o => o.Delay);
//columns.Bound(o => o.DeadlineDist);
//columns.Bound(o => o.DistStatus);
//columns.Bound(o => o.SubmitDate);
//columns.Bound(o => o.LastAct);
//columns.Bound(o => o.LastComment);
})
.Sortable()
.Scrollable()
.Filterable()
.Selectable()
)
</div>

I'm using a stored procedure pulled in through the Model. At first I had trouble with the proc parameter so I hardcoded one and still no luck. This is driving me crazy! Thanks in advance

Marin
Telerik team
 answered on 14 Oct 2016
1 answer
254 views

Ive written some extension methods for various UI components for example here is one for the TextBox

 

        public static TextBoxBuilder<T> Width<T>(this TextBoxBuilder<T> builder, int width)
        {
            return builder.HtmlAttributes(new { @style = "width:" + width.ToString() + "px" });
        }

 

However I cant get the syntax correct for the NumericTextBoxBuilder

 

        public static NumericTextBoxBuilder<T> Width<T>(this NumericTextBoxBuilder<T> builder, int width)
        {
            return builder.HtmlAttributes(new { @style = "width:" + width.ToString() + "px" });
        }

 

I get a message The type 'T' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'NumericTextBoxBuilder<T>'

 

I could find an example working on google, can anyone assist



Daniel
Telerik team
 answered on 14 Oct 2016
3 answers
439 views

In my spreadsheet decimal separator in number cells is dot instead of comma (with the latter being proper to my culture). I set kendo.culture before loading spreadsheet widget and while debugging the current culture setting values seems OK, but they are not applied to spreadsheet.

I have set  "#,##0.00" format to my number cells to display numbers properly and it works fine with a few exceptions:

- when writing a formula numbers must have dot separator

- loading data from external spreadsheet file in widget shows numbers with dot separator

 

Are there ways to get this done that I'm not aware of or this is just not supported, and if so are there plans to improve it in next versions?

Peter Milchev
Telerik team
 answered on 13 Oct 2016
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
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
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?