Telerik Forums
UI for ASP.NET Core Forum
0 answers
381 views

I'm dealing with a situation specified here in the jQuery world: https://docs.telerik.com/kendo-ui/knowledge-base/combobox-invalid-form-control-is-not-focusable

I'm having a similar issue but am using a combination of tag-helpers and Html extension methods to render controls. Kendo Text boxes are getting client-validated properly, but DropDowns are not, and also some textboxes that are initially hidden are also facing the same issue.

DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
 asked on 13 Oct 2022
1 answer
406 views

I have a view setup the following way:

@for (var i = 0; i < Model.ApprovingRoles.Count; i++)
{
    <div class="col-lg-6">
        @(Html.Kendo().DropDownListFor(m => m.ApprovingRoles[i])
              .Size(ComponentSize.Medium)
              .Rounded(Rounded.Medium)
              .FillMode(FillMode.Outline)
              .OptionLabel("Select " + Model.ApprovingRoles[i].Name)
              .HtmlAttributes(new { style = "width: 100%", required = "required", validationmessage = "Value required" })
              .DataTextField(nameof(SystemUserModel.EmployeeName))
              .DataValueField(nameof(SystemUserModel.Id))
              .Filter(FilterType.Contains)
              .DataSource(source =>
              {
                  source.Read(read =>
                  {
                    read.Action("GetUsersByRoleId", "Api").Data(Model.ApprovingRoles[i].Id.ToString());
                  }).ServerFiltering(true);
              })
              .Height(500)
            )
    </div>
}

  1. Is this the correct way to display the drop-downs in a loop?
  2. Each dropdown needs to apply a filter to the GetUsersByRoleId API, and the value is in m.ApprovingRoles[i].Id
  3. Did I set up the read.Action().Data() correctly?

Currently:

  • Four dropdowns appear which is correct
  • They have the correct Option label
  • They have no data, which should not be the case
  • I have a breakpoint on the GetUsersByRoleId, and I'm just receiving a 0 for my int roleId parameter.
Alexander
Telerik team
 answered on 12 Oct 2022
1 answer
144 views

Hello this is my Controller in my code I am trying to update or delete from the database.

I get a 200 status which says its succesful but it never gets updated or deleted.

I can read and create fine but updating is a little challenging.

this is the response i get from the debbuger when i edit a row:

Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished HTTP/1.1 POST https://localhost:57770/Grid/ClientsEdit/14416 application/x-www-form-urlencoded;+charset=UTF-8 176 - 200 - application/json;+charset=utf-8 683.0242ms
public ActionResult ClientsEdit(int id, ClientDatum clientDatum, [DataSourceRequest] DataSourceRequest request)
        {
            PrincipalContext pc = new PrincipalContext(ContextType.Domain, "WIX");
            UserPrincipal up = UserPrincipal.FindByIdentity(pc, User.Identity.Name);
            GroupPrincipal ad = GroupPrincipal.FindByIdentity(pc, "Administrators");
            GroupPrincipal gr = GroupPrincipal.FindByIdentity(pc, "Gr");
            clientDatum = _clientContext.ClientData.Find(id);
            var clients = _clientContext.ClientData.ToList();
            var dsClient = cleints.ToDataSourceResult(request);
         
            if (id == null)
            {
                return BadRequest();
            }
            else if (gangDatum == null)
            {
                return NotFound();
            }
            else if (User.Identity.IsAuthenticated && (up.IsMemberOf(ad) || up.IsMemberOf(gr)))
            {
                if (ModelState.IsValid)
                { 
                    _clientContext.ClientData.Update(clientDatum);
                    _clientContext.Entry(clientDatum).State = EntityState.Modified;
                    _clientContext.SaveChanges();
                }
                return Json(clients);
            }
            else
            {
                string msg = "You need to authenticate to create a user";
                return Json(msg);
            }
        }



<div class="row">
    <div class="col-12">
        @(Html.Kendo().Grid <TelerikGangsApp.Models.ClientDatum>()
                            .Name("grid")
                            .Columns(columns =>
                            {   
                                //columns.Bound(p => p.Id);
                                columns.Bound(p => p.FirstName);
                                columns.Bound(p => p.MiddleName);
                                columns.Command(command => command.Edit()).Width(150);
                                columns.Command(command => command.Destroy()).Width(150);
                            })
                            .ToolBar(toolbar => 
                            {
                                toolbar.Create();
                                //toolbar.Save();
                                toolbar.Pdf();
                                toolbar.Search();
                            })
                            .Pdf(pdf => pdf
                            //.AllPages()
                            .AvoidLinks()
                            .PaperSize("A1")
                            .Margin("2cm", "1cm", "1cm", "1cm")
                            .Landscape()
                            .RepeatHeaders()
                            .TemplateId("page-template")
                            .FileName("Gangs.pdf")
                            .ProxyURL(Url.Action("PdfExport", "Grid"))
                            )
                            .Editable(editable => editable.Mode(GridEditMode.InLine))
                            .Pageable()
                            .Sortable()
                            .Scrollable()
                            .Filterable()
                            .Groupable()
                            .HtmlAttributes(new { style = "height:550px;" })
                            .DataSource(dataSource => dataSource
                                .WebApi()
                                .Batch(false)
                                .PageSize(20)
                                .ServerOperation(false)
                                .Model(model => {
                                    model.Id(client => client.Id);
                                    model.Field(client => client.Id).Editable(false);
                                })
                                .Read(read => read.Action("ClientRead", "Grid").Type(HttpVerbs.Get))
                                .Create(create => create.Action("ClientCreate", "Grid").Type(HttpVerbs.Post))
                                .Update(update => update.Action("ClientsEdit", "Grid", new {id = "{0}"}).Type(HttpVerbs.Post))
                                .Destroy(destroy => destroy.Action("ClientDelete", "Grid", new {id = "{0}"}).Type(HttpVerbs.Post))
                            )
        )
    </div>
</div>
Mihaela
Telerik team
 answered on 10 Oct 2022
2 answers
5.0K+ views

In my .net core app, I have a kendo grid in which I am trying to add buttons to edit /update& delete the rows. Basically what I am trying to do is get the objectid from the parameter in the row and redirect to an update or delete view.

<div class="clearfix">
        @(Html.Kendo().Grid<M20_AEK.Models.ContractSettlement>()
                    .Name("ContractSettlementGrid")
                    .Editable(editable => editable.Mode(GridEditMode.InLine))
                    .Pageable(pageable => pageable.Input(true).Numeric(false))
                    .Scrollable()
                    .Sortable()
                    .Filterable()
                    .ColumnMenu()
                    .Groupable()
                    .Columns(columns =>
                    {
                        columns.Bound(c => c.OBJECTID).Title("ID").Hidden();
                        columns.Bound(c => c.OPERATOR_OBJECTID).Title("Operator").Width("100px");
                        columns.Bound(c => c.Year).Title("Year").Width("100px");
                        columns.Bound(c => c.Month).Title("Month").Width("100px");
                        columns.Bound(c => c.SETTLEMENT_OBJECTID).Title("Settlement").Width("100px");
                        columns.Bound(c => c.TECHNOLOGY_OBJECTID).Title("Technology").Width("100px");
                        columns.Bound(c => c.UPLOAD_SPEED_CLASS_OBJECTID).Title("Upload").Width("100px");
                        columns.Bound(c => c.DOWNLOAD_SPEED_CLASS_OBJECTID).Title("Download").Width("100px");
                        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
                    })
                    .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Events(events => events.Error("error_handler"))
                    .Model(model => model.Id(p => p.OBJECTID))
                    .Read(read => read.Action("LoadSettlementContracts_Read", "SettlementContract"))
                    .Update(update => update.Action("Save", "SettlementContract"))
                    .Destroy(update => update.Action("Delete", "SettlementContract"))
                    )
        )
    </div>

 

I tried to map the command.Edit() & the command.Destroy() commands to use my corresponding methods my controller. When I click the Update button, I get an error in console:

Failed to load resource :44326/SettlementContract/Save:1 the server responded with a status of 400 ()

Can I map the buttons the way I am trying to? It's not even calling the corresponding methods, it's not hitting my breakpoints. Maybe it can't be done like this?

Andi
Top achievements
Rank 1
Iron
Iron
 answered on 07 Oct 2022
1 answer
218 views

Writing an ASP.NET Core application (c#) and I'm wondering if Telerik has any controls that would work for a web camera control.

We need to scan QR codes and would like to be able to do on assigned tablets and also have sales people scan with their phones.  I  know there are some open source projects out there, but hoping Telerik also has a useable camera control.

 

Thanks

Stoyan
Telerik team
 answered on 07 Oct 2022
1 answer
9.6K+ views

Hello Telerik Developers. I am new to Progress Telerik but I am catching up faster than I ever thought.

I was looking to add a new item into my database. While adding I get the error above.

The Primarykey in this case is set to autogenerate in the database and I have it specified in its Context Class:

entity.Property(e => e.Id).ValueGeneratedOnAdd().HasColumnName("id");

Is there any option to adding without setting the  IDENTITY_INSERT TABLE ON? 

I am looking to have the Id incremented on Add without having to enter it on my own. I was looking at a solution here, but that is not what I am looking for.

 

Any help is appreciated.

 

Thank you.

 

 

Stoyan
Telerik team
 updated answer on 06 Oct 2022
1 answer
123 views

I have an ASP.Net Core web app running in Azure (MVVM pattern).
It works correctly on desktop/laptop computers. Most of it runs correctly on Android devices (tested on Android 9, 11 & 13 with Chrome & Edge), but there is one piece that doesn't work correctly.

 

When I try to execute an inform table (for lack of better description), it doesn't display the fields in Android browsers. Below is a description of the issue This is contained in a fieldset in the FormAddEdit view (.cshtml) and the controls are in a partial view.

 

It's working off of a kendo template defined in javascript in the FormAddEdit view. Other javascript functionality is working.

This is based on operation on a laptop.

Figure A enter image description here

Clicking on the + button the following should be displayed, and the user can select the date/time, enter treatment

 

Figure B enter image description here

Clicking outside the row, the following would be displayed

 

Figure C enter image description here

 

This is based on operation on an android tablet. Figure A (as above) would be displayed

Click on + displays figure D

 

Figure Denter image description here

The expected display is Figure B

If there was a treatment present, this is operation on android 

 

Figure E

enter image description here

Clicking the pencil (edit) briefly displays something but returns to this display. It should display the data entry fields as shown in figure b, except showing the data. Clicking on the + (add new), displays what is shown in figure F

 

Figure F enter image description here

 

Is there something that needs to be changed when running on an Android browser?

Stoyan
Telerik team
 answered on 06 Oct 2022
1 answer
368 views

I would like to retain the selected tab when refreshing the page, or when navigating back from another page.  I have some code to capture the currently selected tab:


function onSelect(e) {
            console.log(e.item.innerText)
            
            $.ajax({
                type: "POST",
                url: "/Customers?handler=SelectTab&SelectedTab=" + e.item.innerText,
                beforeSend: function (xhr) {
                xhr.setRequestHeader("XSRF-TOKEN",
                    $('input:hidden[name="__RequestVerificationToken"]').val());
                }
            });
        }

And I am using the following when the page loads, in order to set the selected tab on page load, but it doesn't show the tab properly (being called from $(document).ready):

function selectTab(tab) {
            var tabStrip = $("#customer-tabstrip").data("kendoTabStrip");
            var t = $("li:contains('" + tab + "')");
            tabStrip.select(t);
            tabStrip.activate(t);
        }
The main tab is still selected, but with the tab I am programmatically selecting appended below the main tab.  I am not sure what I am doing wrong...
Alexander
Telerik team
 answered on 06 Oct 2022
1 answer
158 views

Hello,

I need a grid to fill 100% of the container. The grid is inside a view that has a header and footer layout. What I need is for the grid to have a vertical scroll but not to overflow the container so that the scroll is displayed in the grid and not in the browser window. Also 2 of the columns are fixed (the first 2 columns).

Thanks

Stoyan
Telerik team
 answered on 06 Oct 2022
1 answer
191 views

Hi!

Is there a way to have a very limited set of HTML tags allowed for the editor? Especially when pasting formatted text?

For example, I only want user to have Bold, Italic, Underline, bullets (ordered and list), and tables.

Any thing else should not be accepted when typed, command buttoned, or pasted.

Alexander
Telerik team
 answered on 05 Oct 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?