Hi
I have a wizard that loads partials as steps. Whenever I add more than one kendo component (for example a gauge and a slider) onto the same partial the second component renders outside of the wizards' container.
Please assist with this.
Kind Regards
IHostingEnvironment used in FileManager is long obsoleted.
Any plan to upgrade to IWebHostEnvironment soon?
thank you.
I tried to add a badge to a button after successfull retrieving data by an ajax call:
@(Html.Kendo().Button()
.Name("postbox")
.ImageUrl("../../images/mail-black.svg")
.Content("Postfach")
.Events(e => e.Click("onClickPostbox"))
.HtmlAttributes(new { @class = "button-box", style = style }))
When document is loaded i use ajax to retriev data:
$(document).ready(function () {
$.ajax({
contentType: 'application/json; charset=utf-8',
url: '/Dks/GetPostboxData',
type: 'GET',
cache: false,
data: null,
success: function (data) {
console.log(data);
if (typeof data !== 'undefined' && data.length > 0) {
var unreadDocuments = data.filter(doc => doc.Read == false);
console.log(unreadDocuments);
//Here I want to do something like this:
$("#postbox").data('kendoButton').Badge({
text: unreadDocuments.length,
shape: "circle",
themeColor: "error",
align: "top end",
visible: unreadDocuments.length > 0
});
}
},
error: function (error) {
console.log(JSON.stringify(error));
}
});
});
I didn't find a way to do this. Did I miss something?
Kind regards
Timo
I'm trying to add a kendo grid to a Razor Pages app. The grid is simple, pretty much straight out of the samples. However, when I load the page, I get an empty grid and the error below (also on the attached screenshot):
Migrate entirely to HTTPS to have cookies sent to same-site subresources
A cookie was not sent to an insecure origin from a secure context. Because this cookie would have been sent across schemes on the same site, it was not sent. This behavior enhances the SameSite
attribute’s protection of user data from request forgery by network attackers.
Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS. It is also recommended to mark the cookie with the Secure
attribute if that is not already the case.
Here's the code:
Page:
@(Html.Kendo().Grid<tblEmployeeHardware>()
.Name("grid")
.Groupable()
.Sortable()
.Editable()
.Scrollable()
.Columns(columns =>
{
columns.Bound(column => column.HardwareDescription);
...
columns.Bound(column => column.SerialNumber);
columns.Command(column =>
{
column.Destroy();
}).Width(230);
})
.DataSource(ds => ds.Ajax()
.Read(r => r.Url("/Groups/IT/Hardware?handler=Read").Data("forgeryToken"))
.Destroy(d => d.Url("/Groups/IT/Hardware?handler=DeleteHardware").Data("forgeryToken"))
.Model(m => m.Id(id => id.Id))
.PageSize(30)
)
.Pageable()
)
<script>
function forgeryToken() {
return kendo.antiForgeryTokens();
}
</script>
Model:
public JsonResult OnPostDeleteHardware([DataSourceRequest] DataSourceRequest request, tblEmployeeHardware model)
{
var db = new DbAccessHelper(Settings);
db.CreateUpdateDelete("DELETE FROM tblEmployeeHardware WHERE Id = @ID",
new Dictionary<string, string> { { "ID", model.Id.ToString() } });
return new JsonResult(new[] { model }.ToDataSourceResult(request, ModelState));
}
public JsonResult OnGetRead([DataSourceRequest] DataSourceRequest request, string additionalParameter)
{
var ret = getHardware();
//The received parameter "additionalParameter" can be used for filtering/checking the data before returning it to the Grid.
return new JsonResult(ret.ToDataSourceResult(request));
}
I added the [RequireHttps] attribute to the SharedModel, and the following to program.cs:
builder.Services.ConfigureApplicationCookie(options =>
{
options.Cookie.SameSite = SameSiteMode.None;
});
Neither helped.
Can you guys give me a hand here?
Quesiton1.
If I had a series of datas, with the data below
X = {"1.1", "2.2", "3.4", "4.2", "5.3", "6.1", "7.3", "8.2", "9..1", "10.2", "11.4", "12.1"}
Y = {0.1, 3.907, 7.943, -7.3, 7.848, -1.8, 9.263, -4.2, 3.890, 8.238, 9.552, 6.855}
How can I show XAxis Scale with CategoryAxis Majorticks?
Quesiton2.
Extend the scenario above,
the last Value of X is 12.1, What if I would like to set the range of the scale from 0 to 20 or something else,
What should I set with the CategoryAxis?
It is like changing the max scale of XAxis dynamically, which depends on the first and the last value of the series of data.
if the first value and last value were 1.1 and 12.1, than the min and max would be -4 to 17
Min scale = first vale - 5 (round up) = -4
Max scale = last value + 5 (round up) = 17
Example
What I've tried on REPL
@section HeadContent {
<style>
#chart {
background: center no-repeat url('@Url.Content("~/shared/styles/world-map.png")')
}
</style>
}
<div class="demo-section wide">
@(Html.Kendo().Chart()
.Name("chart")
.Title("Test Setting Scale")
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.ChartArea(chartArea => chartArea
.Background("transparent")
)
.SeriesDefaults(seriesDefaults =>
seriesDefaults.Line().Style(ChartSeriesStyle.Smooth)
)
.Series(series => {
series.Line(new double[] { 0.1, 3.907, 7.943, -7.3, 7.848, -1.8, 9.263, -4.2, 3.890, 8.238, 9.552, 6.855 }).Name("MyData");
})
.CategoryAxis(axis => axis
.Categories("1.1", "2.2", "3.4", "4.2", "5.3", "6.1", "7.3", "8.2", "9..1", "10.2", "11.4", "12.1")
.MajorGridLines(lines => lines.Visible(false))
//.BaseUnit(ChartAxisBaseUnit.Fit)
.MajorTicks(t => t.Step(1))
)
.ValueAxis(axis => axis
.Numeric().Labels(labels => labels.Format("{0}%"))
.Line(line => line.Visible(false))
.AxisCrossingValue(-10)
)
.Tooltip(tooltip => tooltip
.Visible(true)
.Format("{0}%")
)
)
</div>
I have a grid which has a custom popup editor. When the editor opens I need to know whether I am in Edit or Create mode.
.Editable(e=> e.Mode(GridEditMode.PopUp) .TemplateName("CompanyOwnersEditor") .Window(w => { w.Animation(false); w.HtmlAttributes(new { @class = "grid-popup-window" }); w.Name("companyOwnersEditor"); }) )
When I am in Edit mode my datasource for one of my DropDownList will be different than Create.
I am unable how to figure this out and Model is always null.
Hello...
I have a grid on a razor page that shows related data to the main model. The grid has the usual CRUD operation buttons and there are corresponding post code in the .CS file. The anti-forgery token is configured and sent with each call back to the server. The grid is using in-line editing, so nothing custom at all. I have a Read operation defined, but because I am binding from the server it never gets called (just there for consistency). This is the grid in the CSHTML page:
@(Html.Kendo().Grid<SettlementHistoryModel>(Model.CoDefendantList)
.Name("coDefendantGrid")
.Mobile(MobileMode.Phone)
.DataSource(ds => ds
.Ajax()
.PageSize(30)
.Events(ev => ev.Error("errorHandler"))
.Model(m =>
{
m.Id(cod => cod.SettlementId);
m.Field(f => f.SettlementId).Editable(false);
})
.Batch(false)
.Create(c => c.Url("/CaseEdit?handler=NewCoDefendant").Data("forgeryToken"))
.Read(r => r.Url("/CaseEdit?handler=ReadCoDefendant").Data("forgeryToken"))
.Update(u => u.Url("/CaseEdit?handler=UpdateCoDefendant").Data("forgeryToken"))
.Destroy(d => d.Url("/CaseEdit?handler=DeleteCoDefendant").Data("forgeryToken"))
.ServerOperation(false)
)
.Pageable()
.Sortable(s => s
.AllowUnsort(true)
.SortMode(GridSortMode.Mixed)
.ShowIndexes(true)
)
.ToolBar(tb => tb.Create())
.Editable(ed => ed.Mode(GridEditMode.InLine))
.Scrollable(s => s.Enabled(true).Height("auto"))
.Columns(c =>
{
c.Command(c =>
{
c.Edit();
c.Destroy();
}).Width("15%").HtmlAttributes(new { style = "vertical-align: top;"}).Title("Actions");
c.Bound(res => res.SettlementId).Title("ID").Width("5%");
c.Bound(res => res.CaseId).Title("Case").Width("5%");
c.Bound(res => res.Codefendant).Title("Co-Defendant").Width("15%");
c.Bound(res => res.Settlement).Title("Settlement").Format("{0:c2}").Width("10%");
c.Bound(res => res.SettlementDate).Title("Settlement Date").Format("{0:MM/dd/yyyy}").Width("10%");
c.Bound(res => res.Comments).Title("Comments").Encoded(false);
})
.ColumnMenu(m => m
.ComponentType("modern")
.Columns(cm => cm.Sort("asc")))
.Reorderable(r => r.Columns(true))
.Resizable(rs => rs.Columns(true)))
Ok, so data populates in the grid with no problem and the appropriate Add, Edit and Delete buttons appear where they should. The appropriate post method is called. Here, for example, is the Update method:
public JsonResult OnPostUpdateCoDefendant(SettlementHistoryModel settlement, [DataSourceRequest] DataSourceRequest request)
{
// Check for a valid object
if (settlement != null)
{
//_context.SettlementHistories.Update(settlement);
//_context.SaveChanges();
}
// And return the JSON for the object
return new JsonResult(new[] { settlement }.ToDataSourceResult(request, ModelState));
}
The problem? When this method is hit, the SettlementHistoryModel object is not null, but all of the properties of the singular object ARE null (except the SettlementId, which is 0). It doesn't matter how the grid gets the data (server binding or Read action), which order the items are in the method signature, etc. The method is called, but ultimately the operation will fail because there is nothing in the SettlementHistoryModel object.
I've downloaded the grid demo and that seems to work. My code is pretty much exactly the same as the demo code, yet there is no way I have tried that gets my code working.
What am I missing?
In my webAPI i'm using the [Authorize] control.
When I call my webAPI to populate a grid or a dropdown with this code
.DataSource(source=>source.Custom()
.Transport(transport=>transport.Read(read=>
{
read.Url($"{WebApiUrl}")
.DataType("json").Data("forgeryToken");
})
)
.PageSize(12)
only in localhost it returns this error <Failed to load resource: the server responded with a status of 401 (Unauthorized)> .
Instead if I use an ajax call in javascript it works
$.ajax({
url: `${WebApiUrl}`,
method: 'get',
crossDomain: true,
cache: false,
xhrFields: {
withCredentials: true,
},
success: function (data) {
options.success(data)
}
})
I've searched in google but i didn't find anything that can help me. Do I have to pass the credentials somehow?
Thank you