Hello,
I can't get the Destroy method to work, I often get a 415 error with the GetListUsersDto object as parameters.
@(Html.Kendo().Grid<GetListUsersDto>().Name("GetListUsersGrid")
.Groupable()
.Sortable()
.Editable()
.Scrollable()
.ToolBar(x => x.Create())
.Columns(columns =>
{
columns.Bound(c => c.ID).Title(@Localizer["Tab_User_Id"].Value);
columns.Bound(c => c.Surname).Title(@Localizer["Editing_User_Surname"].Value);
columns.Bound(c => c.Firstname).Title(@Localizer["Editing_User_Firstname"].Value);
columns.Bound(c => c.RoleName).Title(@Localizer["Editing_User_Role"].Value);
columns.Bound(c => c.DateDebActif).Title(@Localizer["Editing_User_Start_Date"].Value).Format("{0:M/d/yyyy HH:mm:ss}"); ;
columns.Bound(c => c.DateFinActif).Title(@Localizer["Editing_User_End_Date"].Value).Format("{0:M/d/yyyy HH:mm:ss}"); ;
columns.Command(c =>
{
c.Edit();
c.Destroy();
});
}).DataSource(dataSource => dataSource.Ajax()
.Read(r => r.Action("getusers", "admin"))
.Create(r => r.Action("createuser", "admin"))
.Destroy(r => r.Action("deleteuser", "admin"))
.Model(model =>
{
model.Id(m => m.ID);
model.Field(f => f.ID).DefaultValue(Guid.NewGuid());
}
)).Pageable())
[HttpPost]
[Authorize(PolicyEnum.Administrateur)]
[Route("deleteuser")]
public string DeleteUser([DataSourceRequest] DataSourceRequest request, GetListUsersDto dto)
{
//var result = adminService.DeleteUser(dto.ID);
return JsonConvert.SerializeObject(new {/* error = result.IsError, message = localizer[result.IdMessage].Value + result.Message */});
}
public class GetListUsersDto
{
public Guid ID { get; set; }
public string Surname { get; set; }
public string Firstname { get; set; }
public string Username { get; set; }
public bool IsActif { get; set; }
public int RoleId { get; set; }
public string RoleName { get; set; }
public int LangId { get; set; }
public string LangName { get; set; }
public DateTime DateDebActif { get; set; }
public DateTime DateFinActif { get; set; }
}
If I change my GetListUsersDto method to Guid ID, the method works but the Guid is empty.
[HttpPost]
[Authorize(PolicyEnum.Administrateur)]
[Route("deleteuser")]
public string DeleteUser([DataSourceRequest] DataSourceRequest request, Guid Id)
{
//var result = adminService.DeleteUser(Guid.Parse(ID));
return JsonConvert.SerializeObject(new {/* error = result.IsError, message = localizer[result.IdMessage].Value + result.Message */});
}
If I only set a DataSourceRequest request, the method works, but doesn't return a usable object for my service.
[HttpPost]
[Authorize(PolicyEnum.Administrateur)]
[Route("deleteuser")]
public string DeleteUser([DataSourceRequest] DataSourceRequest request)
{
//var result = adminService.DeleteUser();
return JsonConvert.SerializeObject(new {/* error = result.IsError, message = localizer[result.IdMessage].Value + result.Message */});
}
I don't know what to do. Does anyone have a solution or idea?
Thank you,
Hi Telerik,
I got an issue when rendering kendo datepicker. At first time we open the page, the value of Kendo datepicker populated. But then, after refresh (via browser button or f5) the value was gone, and only the format shown like below:
The only way to make it populated is to:
Here is how I render the kendo datepicker
@(Html.Kendo()
.DatePickerFor(x => x.FldBirthdate)
.Max(DateTime.Now)
.DateInput()
.Format("dd/MM/yyyy")
.ParseFormats(new List<string>() { "dd MMM yyyy" })
.HtmlAttributes(customAttributes)
.Events(x => x.Change("dateOnChange"))
)
I already tried to remove the max, dateinput(), format, parseformat, htmlattributes but the problem still persist.
There is no error message shown in the console.
Kendo version: 2019.3.1023
Jquery version: 3.4.1
Please advise.
Thank you.
We have this weird scenario where occasionally we get this, and a refresh and it may go away, its 99% not there and 1% of the time shows.
Happens in
Windows
DropDownList
Is anyone else having any issues trying to download packages using NuGet? I am trying to get the Telerik.UI.for.AspNet.Mvc4 package (latest version) and am getting this error:
Error downloading 'Telerik.UI.for.AspNet.Mvc4.2022.2.802' from 'https://nuget.telerik.com/v3/package/telerik.ui.for.aspnet.mvc4/2022.2.802/telerik.ui.for.aspnet.mvc4.2022.2.802.nupkg'.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
I am also pursuing this with our internal help desk, but wanted to see if the problem was larger than just me.
Thanks!
Hi all,
I have a grid with multiple cascading dropdown columns, each dropdown gets filtered calling a method in my controller.
What I want now it is simply populate a non editable text column based on the value from one of my previous dropdowns calling a filter method on my controller.
Thank you
LnZ
Hi,
We are using the current culture fr-BE which uses dd-MM-yyyy format but when using the DatePicker and inspecting the HTML, we see the following.
As you can see in the screenshot below, the culture is correctly set.
This happens only with fr-BE, we can see no problems when switching between nl-NL, en-GB, nl-BE, etc.
When we add .Format("d") the component works correctly but that's not what I would expect, since "d" is the default.
And to be honest, I don't want to add that manually everywhere. It should take the correct one as a default.
Our current version is 2022.3.913 but updating is not possible at the moment.
Any help would be appreciated
Kind regards
Hi I'm attempting to repeat a vehicle (year/make/model) set of cascading dropdown lists in a component that would result in up to 3 vehicle selectors on the same form. Running into issues as the ddls have the same ids. I've been playing around with appending counters to the name etc but running into the issue where the last set of ddls gets the data. Wondering
1. If there is a working example of this scenario
2. If it is possible to pass a value to the filter function
Thanks.
I'm having an issue with a Grid component. I have 2 custom editors for 2 small dropdown lists. Anytime I select anything other than the default options for either (or both) dropdown lists, the default still gets assigned to the field for some reason. I've tried debugging but it seems that it's getting changed before anything is sent to the controller (defaults are already present in the post action).
I set the custom editors up using the instructions here.
This is the component itself
@(
Html.Kendo().Grid<CHAASAddInsuredsViewModel>()
.Name("AddlInsureds")
.Columns(columns =>
{
columns.Bound(c => c.FirstName).Width(130);
columns.Bound(c => c.MiddleInitial).Width(70);
columns.Bound(c => c.LastName).Width(150);
columns.Bound(c => c.DOB).Format("{0:MM/dd/yyyy}").Width(150);
columns.Bound(c => c.RelationshipType)
.ClientTemplate("#=RelationshipType.RelationshipName#")
.EditorTemplateName("RelationshipTypeEditor").Width(140);
columns.Bound(c => c.Gender)
.ClientTemplate("#=Gender.GenderName#")
.EditorTemplateName("GenderEditor").Width(150);
columns.Bound(c => c.SSN).Width(160)
.HtmlAttributes(new { @class = "text-center" });
@* .EditorTemplateName("SSNEditorTemplate"); *@
@* .ClientTemplate("<h4>XXX-XX-XXXX</h4>"); *@
columns.Command(c => { c.Edit(); c.Destroy(); });
}
)
.ToolBar(toolbar => toolbar.Create().Text("Add Family Member"))
.Editable(editable => editable.Mode(GridEditMode.InLine)
.ConfirmDelete("Continue to delete this record?")
.DisplayDeleteConfirmation("Continue to delete this record?"))
.Sortable()
.Scrollable()
@* .HtmlAttributes(new { style = "height:550px;" }) *@
.DataSource(d => d
.Ajax()
.Model(m =>
{
m.Id(i => i.Id);
m.Field(f => f.RelationshipType)
.DefaultValue(ViewData["defaultRelationshipType"] as HNL_Agents.Models.AddlInsuredRelationshipType);
m.Field(f => f.Gender)
.DefaultValue(ViewData["defaultGender"] as HNL_Agents.Models.AddlInsuredGender);
})
.Events(e => e.Error("error_handler"))
.Create(c => c.Action("Insured_CreateUpdate", "CHAAS", new { modelAppId = Model.AppId }))
.Read(r => r.Action("GetInsureds", "CHAAS", new { modelAppId = Model.AppId}))
.Update(c => c.Action("Insured_CreateUpdate", "CHAAS", new { modelAppId = Model.AppId }))
.Destroy(d => d.Action("RemoveInsureds", "CHAAS"))
)
)
My model is as follows.
public class CHAASAddInsuredsViewModel
These are the custom editors for the drop down lists
@(
Html.Kendo().DropDownList()
.Name("RelationshipType")
.DataValueField("RelationshipId")
.DataTextField("RelationshipName")
.BindTo((System.Collections.IEnumerable)ViewData["relationshipTypes"])
)
@(
Please let me know if there is anything I'm missing or if you need any more information. Thanks for the help!
Hi,
I am getting extra characters like þÿPDF Check in metadata of the exported PDF from Kendo grid. That reflects into the title of the PDF in chrome browser.
Is there any way to remove that extra characters from the metadata using jQuery?
I am attaching screenshot of the PDF file.