Telerik Forums
UI for ASP.NET Core Forum
1 answer
133 views

Hello!

I've got some problems with grid using dynamic model and model validation. I am working on app for viewing and updating sql tables. Everything works perfect except updating values. With dynamic model, I am not able to validate model like in microsoft documentation. ModelState.IsValid property is always false ... and that is a problem. (Edited cells in grid are marked as unsaved after update due to ModelState.IsValid == false). Could you help me ? 

Thx,

Tom

Angel Petrov
Telerik team
 answered on 18 Apr 2018
1 answer
115 views

Hi

I am using asp .net core globalisation as per below documentation:

https://docs.telerik.com/aspnet-mvc/getting-started/globalization

Currently we support two language 'English' and 'French'.

If my current language is 'English' and i change to 'french', the kendo UI gets translated properly.

Where as, current language is 'french' and i change to 'English', UI doesn't gets changed to English strings.

I checked both server and client side culture is properly set as English.

 

Is there something i am missing.

 

Thanks and Regards

Sujin

 

Veselin Tsvetanov
Telerik team
 answered on 18 Apr 2018
5 answers
133 views

I have a condition where a grid that displays normally initially persists in showing the editor for the row on the bottom of the grid after you click the edit button (the first time).  If you click the Edit button again the editor will pop up but you can still see the same editor on the page behind it on the bottom of the grid.  The context and transactional part are fine but I cannot explain why this is happening.  It renders fine with respect to popups on other grids in the solution, like 25 of them.

There is no mistake in the html structure with <divs> that might lead to something like this.

Any suggestions would be welcome.

Reid
Top achievements
Rank 2
 answered on 17 Apr 2018
3 answers
356 views

Hi all,

I'm trying to implement persist state functionality in you Grid. I've followed this example.

localStorage["kendo-grid-orders-options"] = kendo.stringify(grid.getOptions());
.
.
.
grid.setOptions(JSON.parse(localStorage["kendo-grid-orders-options"]));

Everything works fine except for one detail. When I set a filter on DateTime field and then refresh the page, it throws an internal error in method.

The binary operator GreaterThanOrEqual is not defined for the types 'System.DateTime' and 'System.String'.

It's caused by the date in FilterDescriptor in DataSourceRequest, which is sent as a string instead of a DateTime (pict2). When it's sent directly from the filter (not from the stored options), it works correctly (pict1). Am I able to store not just the filter value, but also the information about the type?

Konstantin Dikov
Telerik team
 answered on 17 Apr 2018
2 answers
200 views

Hello, 

I have two ComboBoxes and Grid below them. The combo boxes are used to configure the grid's data source i.e. custom filtering/expanded filtering.

The issue is the following:

1. If I do not scroll the page the combobox options are displayed under the combobox.

2. If I scroll the page and then try to select something from the combobox options, the options are displayed over the grid.

I have attached 2 screen shots that show what is happening.

 

Thank you, 

Martin.

 

Neli
Telerik team
 answered on 16 Apr 2018
1 answer
140 views

Hey guys

Are these topics sufficient to learn Asp.net MVC Core?
Which other advice would you recommend?
I would like to learn Asp.net MVC Core in advance.
Thank you for your valuable information

TOPICS:

Model-View-Controller
Razor
Model Binding
Tag Helpers
Layout, Section, ViewStart
Routing
Bower
Dependency Injection
Entity Framework
Razor Pages
View Components
Filters
Session
Working with Angular
ASP.NET Identity

Konstantin Dikov
Telerik team
 answered on 16 Apr 2018
1 answer
338 views

I have a multiselect that contains a list of states. In the list there are states from different countries. I would like to be able to group the list by country but then have each group sorted by the state abreviation alphabetically. I'm having trouble finding some documentation on how to exctly do this.

 

Here is my multiselect:

@(Html.Kendo().MultiSelect()
.Name("primary_service_area")
.DataTextField("state_abreviation")
.DataValueField("state_abreviation")
.TagTemplate("<span class=\"multiselect-selected-value\">#= state_abreviation #</span>")
.ItemTemplate("<span>#= state_abreviation # - #= state_name #, #= country_code #</span>")
.DataSource(source =>
{
source
.Custom()
.ServerGrouping(true)
.Group(g => g.Add("country_code", typeof(string)))
.Transport(transport =>
transport.Read(read =>
{
read.Action("GetStates", "Company", new { country = "ALL"});
})
)
.ServerFiltering(false);
})
.Events(e => {
e.Change("multiSelect_Change").DataBound("multiSelect_databound");
})
.AutoClose(false)
.Value(Model.primary_service_area)
.HtmlAttributes(new { @class = "omni-multiselect" })
)

 

Here is my GetStates function:

public ActionResult GetStates(string country)
{
    try
    {
        List<State> selectedStates = new List<State>();
        if (country != null)
        {
            if (country == "ALL")
            selectedStates = states.OrderBy(s => s.country_code).ThenBy(s => s.state_abreviation).ToList();                
            else
            selectedStates = states.Where(s => s.country_code == country).ToList();
        }
 
        return Json(selectedStates.Select(s => new { state_abreviation = s.state_abreviation, state_name = s.state_name, country_code = s.country_code }));
    }
    catch (Exception ex)
    {
        return Json("");
    }
}
Neli
Telerik team
 answered on 13 Apr 2018
1 answer
960 views

Hi there

I have imported the telerik mvc core project from visual studio  2017 in windows to Vs Code in Ubuntu 

while installing the dependencies.i got this error  

error : The local source '/home/opendev/Documents/projects/CoreApp02/C:/Program Files (x86)/Progress/Telerik UI for ASP.NET Core R1 2018/wrappers/aspnetcore/Binaries/AspNet.Core' doesn't exist. [/home/opendev/Documents/projects/CoreApp02/PharmaCoreApp02/PharmaCoreApp02.csproj]

 

How can i resolve this ?

Regards 

Muhammad Arsalan Khan 

 

 

Veselin Tsvetanov
Telerik team
 answered on 12 Apr 2018
3 answers
438 views

I have a page where I have to display some data in a grid. The order of columns is dynamic based on the language of the page. The data has to be able to edit it and add new data. I have used the popup editor of the grid. And the editor has to have the same order as the columns in grid (default order).

Also the server will have validation so I used as reference the project https://docs.telerik.com/aspnet-mvc/helpers/grid/how-to/editing/popup-editing-server-validation

I tried to find a way to influence the order without using a custom editor and could not. Is there a way to influence the order of the fields that appear in the popup editor?

I have tried also using a custom editor however when I used 

<span class="field-validation-valid" data-for="Field" data-valmsg-replace="true" data-valmsg-for="Field"></span>

for validation on the page it got converted to this  

<div class="k-widget k-tooltip k-tooltip-validation field-validation-error" id="Field_validationMessage" role="alert" style="margin: 0.5em;" data-valmsg-for="Field" data-for="Field"><span class="k-icon k-i-warning"> </span>The Field is required<div class="k-callout k-callout-n"></div></div>

and I can no longer use the server validation code from the above project.

Is there a way to influence the validation not to change the span?

I do not want to create a custom validation because the server validation has to communicate with the database.

Preslav
Telerik team
 answered on 12 Apr 2018
3 answers
119 views

Hello,
I would like to ask about to grid inside the popup window.
I have a popup window where it contain;
1. Input textbox to set the question.
2. Grid to set the answers (multiple choice).

(Refer Add Question.PNG)

Both are from the different tables in database And the tables are connected using QuizQuestionId inside the Answer Table.

(Refer Question.PNG) and (Refer Answer Table.PNG)

My problem is, I cannot add the answer inside because I dont have the QuizQuestionId (because I dont add the question yet into the database since both question and answer are inside the same window)

However, when I click Next button, I can save my question
My question is is there any way to solve my problem ?

Please let me know if you have any question about this.
Thank you.


This is my next button function

01.function SaveAndGetNextQuestion(quizId, questionId) {
02. 
03. 
04.       //alert('Quiz ID: ' + quizId + '\nQuestion ID: ' + questionId);
05. 
06.           _url = "@Url.Action("", "QuizQUestion")",
07.           isCreateOperation = questionId == null;
08.           if (isCreateOperation)
09.           _url = _url + "/Create";
10.           else
11.           _url = _url + "/Edit";
12.           $.ajax({
13.           method: "POST",
14.           url: _url,
15.           data: {
16.           QuizId: quizId,
17.           Id: questionId,
18.           Question: $("#Question").val(),
19.           QuestionTypeId: $("#QuestionTypeId").val(),
20.           //QuestionNumber: Ques
21.           }
22.           }).done(function (response) {
23.               console.log("respond", response);
24.               if (response.IsSucceeded == true) {
25.                   console.log(response)
26.           $("#questionWin").data("kendoWindow").close();
27.                   if (isCreateOperation !== null) {
28. 
29.           //Ajax request to Get Guestions for Quiz
30.           //Open question window
31.           //e.preventDefault();
32.           var questionTemplate = kendo.template($("#NextQuestionTemplate").html());
33. 
34.           $.ajax({
35.           method: "GET",
36.           url: "@Url.Action("GetQuestionByQuizId", "QuizQuestion")",
37.               data: { QuizId: quizId }
38.           })
39.           .done(function (question) {
40. 
41.           var questionWnd = $("#questionWin").data("kendoWindow");
42.               questionData = { QuizId: quizId, Id: questionId };
43.           if (question == null) {
44.           // Create Mode
45.                
46.           questionWnd.content(questionTemplate(questionData));
47.           }
48.           else { // Edit Mode
49.           questionWnd.content(questionTemplate(questionData));
50.           }
51.           questionWnd.center().open();
52.           }).fail(function (msg) {
53.           result.html("Oops! operation is failed");
54.           result.show();
55.           })
56.           }
57.    }
58.           else {
59.           // display Error messages
60.           var ul = $("<ul />");
61.           $.each(response.Message, function (index, item) {
62.           ul.append($("<li />").html("<span>" + item + "</span>"));
63.           });
64.           var status = $(".result-status");
65.           status.append(ul);
66.           status.addClass("text-danger");
67.           }
68.           }).fail(function (msg) {
69.           result.html("Oops! operation is failed");
70.           result.show();
71.           });
72.           return questionId;
73. 
74.

 

 

 

This is my view inside the popup window

01.<script type="text/x-kendo-template" id="NextQuestionTemplate">
02.    <div class="form-group">
03.        <!--Question Type-->
04.        <div class="col-md-10">
05.            <div class="k-edit-label col-md-2">
06.                <label for="QuestionTypeId">Quiz Type</label>
07.            </div>
08.            <div class="editor-field col-md-6">
09.                @(Html.Kendo().DropDownList()
10.                                                                                .DataTextField("Name")
11.                                                                                .DataValueField("Id")
12.                                                                                .DataSource(source =>
13.                                                                                {
14.                                                                                    source.Read(read =>
15.{
16.        read.Action("GetQuestionTypeList", "ListService");
17.});
18.                                                                                })
19.                                                                                .Name("QuestionTypeId").ToClientTemplate()
20. 
21. 
22.                )
23.            </div>
24.        </div>
25. 
26. 
27. 
28. 
29.        <!--Question-->
30.        <div class="col-md-10">
31.            <div class="k-edit-label col-md-2">
32.                <label for="QuestionId"> Question </label>
33.            </div>
34.            <div class="editor-field col-md-6">
35.                <textarea class="k-textbox"
36.                          data-val="true"
37.                          id="Question"
38.                          name="Question" rows="5" cols="50">#= data.Question #</textarea>
39.            </div>
40.            <br />
41.        </div>
42.        <br />
43. 
44.        <div class="col-md-11">
45.            @(Html.Kendo().Grid<Optivolve.ERP.BusinessModel.Learning.QuizAnswerViewModel>
46.                ()
47.                .Name("answerGrid")
48.                .Columns(columns =>
49.                {
50.                   // columns.Bound(p => p.IsCorrectAnswer);
51.                    columns.Bound(p => p.Answer).Width(100);
52. 
53. 
54.                    columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
55.                })
56.               .ToolBar(toolbar => toolbar.Create())
57.                                                                                                    .Editable(editable => editable.Mode(GridEditMode.InLine))
58.                                                                                                    .Pageable()
59.                                                                                                    .Sortable().AutoBind(false)
60.                                                                                                    .DataSource(dataSource => dataSource
61.                                                                                                            .Ajax()
62.                                                                                                            .Model(model => { model.Id(p => p.Id); })
63.                                                                                                            .ServerOperation(true)
64.                                                                                                        .Create(update => update.Action("Create", "QuizAnswer"))
65.                                                                                                        .Read(read => read.Action("Read", "QuizAnswer"))
66.                                                                                                        .Update(update => update.Action("Edit", "QuizAnswer"))
67.                                                                                                        .Destroy(update => update.Action("Delete", "QuizAnswer")
68.                                                                                                    )).ToClientTemplate()
69.            )
70.        </div>
71.        <!--Button-->
72.        <div class="col-md-10 text-center" style="margin-top:10px">
73.            <button class="k-button k-button-icontext" id="btn_back" onclick="Back(#=data.QuizId# , #=data.Id#)">Back</button>
74.            <button class="k-button k-button-icontext" id="btn_nextQuestion" onclick="SaveAndGetNextQuestion(#= data.QuizId #, #= data.Id #)">Next</button>
75.            <button class="k-button k-button-icontext" id="btn_finish" onclick="Finish()">Finish</button>
76.        </div>
77. 
78.    </div>
79. 
80.</script>
Preslav
Telerik team
 answered on 10 Apr 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?