We are trying to add extra data to a grid via an onscroll listener.
This works when the data is filtered or sorted, but not when grouped.
Below is the code we currently have that is called when new data is needed.
var grid = $("#grid").data("kendoGrid");
var parameterMap = grid.dataSource.transport.parameterMap;
var requestObject = parameterMap({ aggregate:grid.dataSource.aggregate(),sort: grid.dataSource.sort(), filter: grid.dataSource.filter(), group: grid.dataSource.group(), page: pagina, pageSize:grid.dataSource.pageSize() });
$.post('@Url.Action("GetAllOffers_Post", "Offer")', requestObject, function (response) {
try {
grid.dataSource.pushCreate(response.Data); //Works for non-grouped data
} catch (err) {
console.log(err);
try {
//Data is grouped when we end up here
//var data = grid.dataSource.schema.parse(response.Data);
//Array.prototype.push.apply(grid.dataSource.options.schema.groups, response.Data); //API said we could use the schema.parse but that doesn't work nor does the schema.groups since grid.dataSource.schema doesn't exist
} catch (errortwee) {
console.log(errortwee);
}
}
I have basically copied the demo on your site...but I get the following error...any recommendations?
My grid populates, but when I press the Export To Excel button in the grid, nothing happens...
When I inspect my browser I get the following:
SCRIPT5022: JSZip not found. Check http://docs.telerik.com/kendo-ui/framework/excel/introduction#requirements for more details.
kendo.all.js (11412,31)
-------------------------------
I have tried adding the following suggestion from the link, but that does not work
JSZip
To take full advantage of the Excel export feature, download the JSZip library and include the file before the Kendo UI JavaScript files, as shown below.
EXAMPLE
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script><script src="http://cdnjs.cloudflare.com/ajax/libs/jszip/2.4.0/jszip.js"></script><script src="http://kendo.cdn.telerik.com/2016.3.1028/js/kendo.all.min.js"></script>
JSZip is part of the Kendo UI distribution and is also available via the Kendo UI CDN:
<script src="http://kendo.cdn.telerik.com/2016.3.1028/js/jszip.min.js"></script>
------------------------------
@model IEnumerable<Areas.Name.Models.TransactionName>
<h2>Grid</h2>
@(Html.Kendo().Grid<Areas.Name.Models.TransactionName>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.LastName);
columns.Bound(c => c.FirstName);
columns.Bound(c => c.MiddleName1);
})
.BindTo(Model)
.ToolBar(tools => tools.Excel())
.Excel(excel => excel
.FileName("Products.xlsx")
)
.Deferred()
)
@* All initialization scripts are rendered to the bottom of the page, see Layout.cshtml *@
@section scripts {
@Html.Kendo().DeferredScripts()
}
Hi,
I'm trying to change the format for the filter for a date (datepicker in the filterRow from "MM/d/yyyy" to "yyyy-MM-dd"
I attached a screenshot of the result I'm getting
The filter format is "MM/d/yyyy" and my column format is "yyyy-MM-dd" (set by .Format("{0:yyyy-MM-dd}") )
I want the format to be same for both filter and column data - i.e "yyyy-MM-dd"
Column options:
columns.Bound(c => c.DateInvitation)
.Title("Date invitation/rappel")
.Format("{0:yyyy-MM-dd}")
.Width(150)
.Filterable(f => f.Cell(c => c.ShowOperators(false).BindTo(Enumerable.Empty<
string
>())));
grid options:
.Filterable(ftb => ftb.Mode(GridFilterMode.Row)).Filterable()
The checked things in the Grid has to be shown in te CheckBoxList.
In one click on the button everything what has been checked in the grid has to be shown on the CHeckboxlist2.
I made something but its not completed, what do I have to do next?
<asp:Panel runat="server" ID="pnlSource">
<telerik:RadGrid ID="ChangedList" runat="server" AutoGenerateColumns="false" OnPageIndexChanged="ChangedList_PageIndexChanged" OnNeedDataSource="ChangedList_NeedDataSource" GridLines="None" AllowPaging="true" RenderMode="Lightweight" PageSize="5" AllowSorting="True">
<MasterTableView ClientDataKeyNames="Logging_ID" backcolor="PaleGreen" ForeColor="black" BorderStyle="Solid" BorderColor="Green" AlternatingItemStyle-BackColor="MediumSeaGreen" PagerStyle-BackColor ="LawnGreen" HeaderStyle-ForeColor="green" HeaderStyle-BorderColor="Crimson">
<Columns>
<telerik:GridCheckBoxColumn UniqueName="GridCheckBoxColumn" DataField="IsTrue">
</telerik:GridCheckBoxColumn>
<telerik:GridBoundColumn DataField="ModuleName" HeaderText="Naam" UniqueName="ModuleName" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="AssemblyVersion" HeaderText="Versie" UniqueName="AssemblyVersion" ReadOnly="true">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="true" >
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
<br />
<div class="col-md-1" >
<asp:Button ID="ButtonALL" runat="server" Text="Update" OnClick="ButtonALL_OnClick" />
</div>
<asp:Panel runat="server" ID ="pnlSourceNoItems">
<%-- // <asp:Label runat="server" Text="Er zijn geen wijzigingen geconstateerd"/>--%>
</asp:Panel>
</div>
</div>
<div class="col-md-1">
<h3>==></h3><asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_OnClick" meta:resourcekey="btnUpdateResource1" />
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<h3>Websites</h3>
</div>
<div class="col-md-6">
<asp:DropDownList runat="server" id="ddWebserver" AutoPostBack="True" OnSelectedIndexChanged="ddWebserver_OnSelectedIndexChanged"/>
</div>
</div>
<div style="border: black; border-width: 1px; border-style: solid; overflow: scroll; height:300px">
<asp:Panel runat="server" ID="pnlTarget">
<asp:CheckBoxList ID="CheckBoxList2" runat="server" meta:resourcekey="CheckBoxList2Resource1">
</asp:CheckBoxList>
</asp:Panel>
<asp:Panel runat="server" ID="pnlNoItems">
<asp:Label runat="server" Text="Er zijn geen webs waar de update kan worden toegepast" />
</asp:Panel>
</div>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
protected void ButtonALL_OnClick(object sender, EventArgs e)
{
ButtonALL.BackColor = System.Drawing.Color.PaleGreen;
ButtonALL.BorderColor = System.Drawing.Color.Green;
ButtonALL.ForeColor = System.Drawing.Color.Black;
if (ButtonALL.Text == "Update")
{
ButtonALL.Text = "Updated";
}
else
{
ButtonALL.Text = "Update";
}
{
foreach (GridItem item in ChangedList.MasterTableView.Items)
{
GridDataItem dataitem = (GridDataItem)item;
TableCell cell = dataitem["GridCheckBoxColumn"];
CheckBox checkBox = (CheckBox)cell.Controls[0];
if (checkBox.Checked)
{
string value = dataitem.GetDataKeyValue("Logging_ID").ToString(); //Access the checked row using DataKeyNames
}
}
}
}
Hello,
I am trying to list for asp.net core and I get the following null reference exception.
NullReferenceException: Object reference not set to an instance of an object.
Please find the stack trace attached. I tried attaching sample project but it wouldn't allow me.
I have spent a lot of time trying to figure out but failed. I am not sure if I am missing anything.
Any ideas or suggestions on how I can resolve this issue is really appreciated.
Thanks,
Hi,
I'm trying to update a label inside a grid toolbar with the Count on selectedItem of the grid.
I'm able to retrieve the number of selected item with the "onChange" event ( in an JS alert in my test)
using:
<script type=
"text/javascript"
>
function onChange(arg) {
var selected = $.map(
this
.select(), function (item) {
return
$(item).text();
});
alert(selected.length);
}
</script>
but i'm having trouble accessing the label inside the toolbar of the grid (to modify the text property).
I'm not quite sure of the syntax to retrieve the label..
I tried several way to access it and I'm having not luck so far.
Is there a way to access a control inside the toolbar of a grid from JavaScript?
Note: I'm using "Telerik.UI.for.AspNet.Core": "2016.3.914"
Setting the Media in the player declaration for playing mp3 is quite easy :
@(Html.Kendo().MediaPlayer()
.Name("mediaPlayer")
.AutoPlay(true)
.Media(m => m
.Title("this is my song")
.Source("sounds/mysong.mp3") )
.HtmlAttributes(new { style = "height:360px; width:640px" } )
)
But how to change the media source for example if I want to change "mysong.mp3" to "myothersong.mp3" in an event in javascript :
function onChange(arg)
{
$("#mediaPlayer").data("kendoMediaPlayer").media(?????);
}
Many thanks
hi guys,
this was first a checkbox but I had to change it to a Grid.
but the only problem is that the paging is not working... can you guys find the mistake?
(I am a beginner)
<telerik:RadGrid ID="ChangedList" runat="server" AutoGenerateColumns="false" OnPageIndexChanged="ChangedList_PageIndexChanged" OnNeedDataSource="ChangedList_NeedDataSource" GridLines="None" AllowPaging="true" RenderMode="Lightweight" PageSize="5" AllowSorting="True">
<MasterTableView ClientDataKeyNames="Logging_ID" backcolor="PaleGreen" ForeColor="black" BorderStyle="Solid" BorderColor="Green" AlternatingItemStyle-BackColor="MediumSeaGreen" PagerStyle-BackColor ="LawnGreen" HeaderStyle-ForeColor="green" HeaderStyle-BorderColor="Crimson">
<Columns>
<telerik:GridCheckBoxColumn
HeaderText="Checkbox" >
</telerik:GridCheckBoxColumn>
<telerik:GridBoundColumn DataField="ModuleName" HeaderText="Naam" UniqueName="ModuleName" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="AssemblyVersion" HeaderText="Versie" UniqueName="AssemblyVersion" ReadOnly="true">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
--------------------------------------------------------------------------------------------------------------
protected void Page_Load(object sender, EventArgs e)
{
// CheckBoxList1.AutoPostBack = cbAutoRefresh.Checked;
LogChanges();
if (!IsPostBack)
{
ddWebserver.DataSource = controller.Server_List();
ddWebserver.DataTextField = "Description";
ddWebserver.DataValueField = "Server_ID";
ddWebserver.DataBind();
ddWebserver.SelectedIndex = 0;
LoadListboxes();
}
protected void ChangedList_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
}
protected void ChangedList_PageIndexChanged(object sender, GridPageChangedEventArgs e)
{
int index = e.NewPageIndex;
int current = ChangedList.CurrentPageIndex;
}
private void LoadListboxes()
{
//CheckBoxList1.Items.Clear();
CheckBoxList2.Items.Clear();
var changes = controller.Logging_List().Where(x => x.Ignore == false).ToList().OrderBy(x => x.ModuleName);
ChangedList.DataSource = changes;
ChangedList.DataBind();
Whenever I try and download from Nuget Package Explorer I got the following error:
Retrieving package 'Telerik.UI.for.AspNet.Core 2016.3.914' from 'telerik.com'.
GET https://nuget.telerik.com/nuget/Packages(Id='Telerik.UI.for.AspNet.Core',Version='2016.3.914')
OK https://nuget.telerik.com/nuget/Packages(Id='Telerik.UI.for.AspNet.Core',Version='2016.3.914') 79ms
Install failed. Rolling back...
Uninstalling NuGet package Telerik.UI.for.AspNet.Core.2016.3.914.
Executing nuget actions took 132.55 ms
Package contains multiple nuspec files.
========== Finished ==========
Time Elapsed: 00:00:01.8826245
However, when I just edit the project.json manually to include the package and then rebuild to trigger a package restore, it works fine.
"Telerik.UI.for.AspNet.Core": "2016.3.914"
I am using the save/load grid state feature in JS for my Kendo UI MVC Grid. It looks like this:
Saving state:
var grid = $("#Items").data("kendoGrid");
sessionStorage.GridState = kendo.stringify(grid.getOptions());
Loading state:
$(document).ready(function () {
var grid = $("#Items").data("kendoGrid");
var originalOptions = grid.getOptions();
var stringifiedOptions = sessionStorage.GridState;
if (stringifiedOptions) {
console.log("Loaded Grid State.");
var loadedOptions = JSON.parse(stringifiedOptions);
loadedOptions.columns = originalOptions.columns;
grid.setOptions(loadedOptions);
sessionStorage.removeItem("GridState");
console.log("Clearing Grid State Storage.");
}
});
The first time the grid loads, grid state gets saved after clicking the edit button, which takes me to another page, but then if I click back from this edit page to go back to the grid page, it shows this error:
{"There is already an open DataReader associated with this Command which must be closed first."}
dataSourceResult.Total = source1.Count();
And I can see the load grid ajax action is being called twice, and it errors out on the second time. The error occurs when I call MyBaseEntitiesQueryable.ToDataSourceResult(request). I can't debug the Kendo UI code, but when I was able to copy the classes in the grid filtering to mimic it and it occurs on this line in ToDataSourceResult:
dataSourceResult.Total = source1.Count();
The full error and stack trace:
{"There is already an open DataReader associated with this Command which must be closed first."}
at System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command)
at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
{"An error occurred while executing the command definition. See the inner exception for details."}
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at Kendo.Mvc.Extensions.QueryableExtensions.Count(IQueryable source)
at Kendo.Mvc.Extensions.QueryableExtensions.CreateDataSourceResult[TModel,TResult](IQueryable queryable, DataSourceRequest request, ModelStateDictionary modelState, Func`2 selector)
at Kendo.Mvc.Extensions.QueryableExtensions.ToDataSourceResult(IQueryable queryable, DataSourceRequest request, ModelStateDictionary modelState)
at Kendo.Mvc.Extensions.QueryableExtensions.ToDataSourceResult(IQueryable enumerable, DataSourceRequest request)
at Sandbox.Controllers.EntityController`5.LoadGrid(DataSourceRequest request) in C:\Users\shol726\Documents\Visual Studio 2015\Projects\Drs\samples\Sandbox\Controllers\EntityController.cs:line 75
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionFilterAsync>d__28.MoveNext()
To make matters worse, this error happens only about 75% of the time, not all the time. Sometimes I get "The underlying provider failed to Open." as well. But that is much rarer.
How can I fix this?