Telerik Forums
UI for ASP.NET Core Forum
5 answers
170 views

When editing a form with data, when I click the control to "EDIT" my saved date range selection it's opening on Todays date instead of my date range selection.

Any idea how to resolve this?

Viktor Tachev
Telerik team
 answered on 10 Jun 2019
3 answers
222 views

I have a form Razor in .NET Core that I have attached a Kendo Validator to.  When I submit the form validator.validate() is returning false but none of the inputs on the form are displaying a validation error.  How can I tell what validations are failing when validator.validate() returns false?

Razor Form 

<form id="editQuestionsForm" method="post">
    <input asp-for="Input.InspectionQuestionId" type="hidden" />
 
    <div class="row">
        <div class="col-md-12">
            <div class="form-group">
                <label asp-for="Input.InspectionSectionId"></label><br />
                <kendo-combobox name="inspectionSection" style="width: 500px;"
                                for="Input.InspectionSectionId"
                                placeholder="Select Section"
                                datatextfield="Text"
                                datavaluefield="Value"
                                bind-to="Model.InspectionSections">
                    <popup-animation>
                        <open duration="500" />
                        <close duration="500" />
                    </popup-animation>
                </kendo-combobox><br />
                <span asp-validation-for="Input.InspectionSectionId" class="text-danger"></span>
            </div>
        </div>
    </div>
 
    <div class="row">
        <div class="col-md-12">
            <div class="form-group">
                <label asp-for="Input.QuestionTextForForm"></label><br />
                <textarea asp-for="Input.QuestionTextForForm" class="form-control-textarea"></textarea><br />
                <span asp-validation-for="Input.QuestionTextForForm" class="text-danger"></span>
            </div>
        </div>
    </div>
 
</form>

 

JavaScript

var validator = $("#editQuestionsForm").kendoValidator().data("kendoValidator");
 
function validateSave() {
    if (validator.validate()) {
        $('#editQuestionsForm').submit();
    } else {
        bootstrapWarningsMessage("There was an error submitting the form.");
    }
    return true;
}

 

Misho
Telerik team
 answered on 07 Jun 2019
3 answers
157 views

(It's a trial version)

Impossible to display data.

Data are correctly supplied in my form (see DOM capture)

But there is an error :  L’objet ne gère pas la propriété ou la méthode « kendoGrid »

 JS are the same than in examples.

 

 

 

 

 

 

Tsvetomir
Telerik team
 answered on 06 Jun 2019
1 answer
1.0K+ views

I have a window in my _Layout.cshtml which I have initially set to visible="false". When I load or refresh the main page, I get a flickering, such that you can momentarily see the window text and button. I'm using a tag helper if that makes any difference.

 

The following is the _Layout.cshml file. The rest of the solution is just the standard Telerik ASP.Net Core template using ASP.Net Core 2019.2.514 controls on .Net Core 2.2.

 

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - WindowFlickerTest</title>
 
    <link href="https://kendo.cdn.telerik.com/2019.2.514/styles/kendo.bootstrap-v4.min.css" rel="stylesheet" type="text/css" />
 
 
    <environment names="Development">
        <link rel="stylesheet" href="~/lib/bootstrap/css/bootstrap.css" />
        <link rel="stylesheet" href="~/css/site.css" />
    </environment>
    <environment names="Staging,Production">
              asp-fallback-href="~/lib/bootstrap/css/bootstrap.min.css"
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
        <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
    </environment>
</head>
<body class="k-content">
 
    <kendo-window   name="windowChangeUser"
                    title="Change User"                       
                    draggable="true"
                    resizable="false"
                    width="250"
                    height="200"
                    modal="true"
                    visible="false"
                         
    >
        <content>
            <div style="font-size: 13px; padding-top: 20px;">
                <p>
                    Enter a username to switch to
                </p>
                <p style="padding-top: 20px;">
                    <input type="text" class="k-textbox" id="userName" />
                </p>
            </div>
            <div style="padding-top: 20px; text-align: center">
                <kendo-button   name="buttonChangeUserOk"
                                type="submit"
                                on-click="windowClose"
                                     
                >
                    <content>OK</content>
                </kendo-button>
            </div>
        </content>
    </kendo-window>
 
 
 
    <nav class="navbar navbar-inverse navbar-fixed-top p-3">
        <div class="container p-0 p-sm-3">
            <kendo-button id="buttonOpenWindow" on-click="openWindow">
                <content>Show me the window!</content>
            </kendo-button>
 
            <div class="navbar-header">
                <kendo-button name="configure" tag="button" icon="menu" class="k-rpanel-toggle k-primary btn-toggle"></kendo-button>
                <a asp-controller="Home" asp-action="Index" class="navbar-brand">Your .NET Core Application</a>
            </div>
            <div id="responsive-panel" class="navbar-left">
                <kendo-responsivepanel name="responsive-panel" auto-close="false" breakpoint="768" orientation="top">
                    @(Html.Kendo().Menu()
                                .Name("Menu")
                                .Items(items =>
                                {
                                    items.Add().Text("Home").Action("Index", "Home", new { area = "" });
                                    items.Add().Text("About").Action("About", "Home", new { area = "" });
                                    items.Add().Text("Contact").Action("Contact", "Home", new { area = "" });
                                })
                    )
                </kendo-responsivepanel>
            </div>
        </div>
    </nav>
 
    <main>
        <div class="container">
            @RenderBody()
        </div>
    </main>
 
    <footer class="footer text-center d-flex align-items-center">
        <div class="container pb-0">
            <hr />
            <p class="text-muted">
                Copyright © @DateTime.Now.Year Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
            </p>
        </div>
    </footer>
 
    <environment names="Development">
        <script src="~/lib/bootstrap/js/bootstrap.js"></script>
    </environment>
    <environment names="Staging,Production">
                asp-fallback-src="~/lib/bootstrap/js/bootstrap.min.js"
                asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"></script>
    </environment>
    @RenderSection("scripts", required: false)
</body>
</html>
 
<script type="text/javascript">
    function openWindow() {
        var window = $("#windowChangeUser").data("kendoWindow");
 
        window.center();
        window.open();
    }
 
    function windowClose() {
        var window = $("#windowChangeUser").data("kendoWindow");
        window.close();
    }
</script>
Ivan Danchev
Telerik team
 answered on 05 Jun 2019
2 answers
119 views

Hi

I have Grid with 4 columns. When I edit a row, enter number in cell 2, I want to update cell 4 with the result of cell 2 - cell 3.

Can anyone advice how I can do this urgently? Thanks in Advance

Below is the code of my grid

 

@(Html.Kendo().Grid<TransactionCoBroker>()
.Name("GridCommExCoBroker")
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Columns(columns =>
{
    columns.Command(c => c.Edit());
    columns.Bound(u => u.Name).Title("Name");
    columns.Bound(u => u.FNet).Title("Net"));
    columns.Bound(u => u.FTax).Title("Tax"));
    columns.Bound(u => u.FGross).Title("Amount"));
})
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
    model.Id(id => id.ICobrokerId);
    model.Field(p => p.UName).Editable(false);
    model.Field(p => p.FNet).Editable(true);
    model.Field(p => p.FTax).Editable(true);
    model.Field(p => p.FGross).Editable(false);
})
.Events(e => e.Error("onError").RequestEnd("onRequestEnd"))
.ServerOperation(true)
.Read(r => r.Url("?handler=GetExCoBrokerComm").Data("GetTransID"))
.Update(r => r.Url("?handler=SaveBrokerComm").Data("GetTransID"))))
Tsvetomir
Telerik team
 answered on 05 Jun 2019
1 answer
119 views

.Columns(columns =>
      {
          columns.Select().Width(50).Locked(true);

           ....

     }

      .Selectable(selectable => selectable
          .Mode(GridSelectionMode.Multiple)
          .Type(GridSelectionType.Cell))

 

error

Alex Hajigeorgieva
Telerik team
 answered on 04 Jun 2019
1 answer
117 views

//      .ColumnMenu(columnmenu => columnmenu.Columns(true).Filterable(true).Sortable(true))
      .Filterable(filterable =>
      {
          filterable.Mode(GridFilterMode.Menu);
          filterable.Extra(false);
      })

display error

 

      .ColumnMenu(columnmenu => columnmenu.Columns(true).Filterable(true).Sortable(true))
      .Filterable(filterable =>
      {
          filterable.Mode(GridFilterMode.Menu);
          filterable.Extra(false);
      })

display ok

 

 

 

Viktor Tachev
Telerik team
 answered on 04 Jun 2019
1 answer
76 views

      .Filterable(filterable =>
      {
          filterable.Mode(GridFilterMode.Menu);
          filterable.Extra(false);
      })

display error

 

      .ColumnMenu(columnmenu => columnmenu.Columns(true).Filterable(true).Sortable(true))
      .Filterable(filterable =>
      {
          filterable.Mode(GridFilterMode.Menu);
          filterable.Extra(false);
      })

display ok

 

 

 

Viktor Tachev
Telerik team
 answered on 04 Jun 2019
1 answer
621 views
Currently my grid background is the light gray, and the rows alternate between light and dark.  Is it possible to get the unused portion of the grid to be a different color, while leaving the row alternating colors alone?     
Georgi
Telerik team
 answered on 31 May 2019
7 answers
165 views

Hello,

I have a grid with derived objects and I would like to open different edit popup for each type of child object.

I'll give a simplified example:

Models:

public class Product
{
        public string Label { get; set; }
}
public class TypeA: Product
{
        public string PropA { get; set; }
}
public class TypeB: Product
{
        public int PropB { get; set; }
}
 
public class Order
{
        public int Id {get;set;}
        public virtual ICollection<Product> Products { get; set; }
}

 

Controller:

public async Task<Order> GetById(int id)
{
    Order order = await webApi.GetById(id); // webApi is a private service who calls a json converter to return a strongly typed list with derived class
    return order ;
}

 

At this point, the object order have a Products property which is a collection of TypeA, TypeB and Product

Views:

@model Order
<div>
    @(Html.Kendo().Grid<Product>(Model.Products).Name("grid")
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .Columns(columns =>
        {
            columns.Bound(p => p.Label);
            columns.Command(command => { command.Edit(); });
        })
    )
</div>

 

I also create templates in Views\Shared\EditorTemplates

@model Product
 
<div>
    <h1>Product</h1>
</div>
 
-------------------------
 
@model TypeA
 
<div>
    <h1>TypeA</h1>
</div>
 
-------------------------
 
@model TypeB
 
<div>
    <h1>TypeB</h1>
</div>

 

Only the Product template pops up. I guess it's because of Grid<Product> declaration.

How can I strongly typed each row and/or have different editor template? I don't want to show PropA and PropB in my grid but I want to allow to edit them in the popup.

Thanks

 

Georgi
Telerik team
 answered on 31 May 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?