Telerik Forums
UI for ASP.NET MVC Forum
1 answer
257 views
Hi,

I am implementing MVC grid with FullText Search from below link. How do I highlight the search term in the Grid as shown in the attached screenshot?

https://demos.telerik.com/aspnet-mvc/grid/search-panel

Thanks!
Georgi
Telerik team
 answered on 28 Nov 2019
2 answers
215 views

I am trying to get a ComboBoxFor to work inside a Kendo Modal Window. Thing is, the value type is always null.  THis is what I am doing in side a modal window:

 
 
<div class="demo-section k-content">
    <h4>Find a product</h4>
 
    @(Html.Kendo().ComboBox()
          .Name("products")
          .Placeholder("Select product")
          .DataTextField("ProductName")
          .DataValueField("ProductID")
          .HtmlAttributes(new { style = "width:100%;" })
          .Filter("contains")
          .AutoBind(false)
          .MinLength(3)
          .DataSource(source => {
              source.Read(read =>
              {
                  read.Action("ServerFiltering_GetProducts", "ComboBox").Data("onAdditionalData");
              })
              .ServerFiltering(true);
          })
    )
    <div class="demo-hint">Hint: type at least three characters. For example "che".</div>
</div>
 

 

 

 

 

Petar
Telerik team
 answered on 26 Nov 2019
2 answers
212 views
Hello, 

I am brand new to Telerik so bare with me for the question. 

Currently on my Calendar, you have to double click/ double tap on the Calendar event to see the pop up modal. This is causing issues for me on mobile and iOS. 

I was wondering how can i change the doubleClick/ doubleTap  handler to a single click? 


Thank you so much!
Cheers
Veselin Tsvetanov
Telerik team
 answered on 26 Nov 2019
1 answer
1.2K+ views

I'm trying to reset my Editor back to the initial values i have when the page loads on a button press.

 

Is there a way to to this other than setting the values again?

I am able to clear all the values with the following :

        var editor = $("#editor").data("kendoEditor");

        editor.value("")

Would i have to input the initial text again in the .value()?

Veselin Tsvetanov
Telerik team
 answered on 25 Nov 2019
1 answer
637 views

i have inserted a new item at server side. I need to refresh the dropdownlist and select the latest item.

i tried read, refresh & sync but it failed. Please help.

@(Html.Kendo().DropDownList()
.Name("Job.ITransfereeId")
.HtmlAttributes(new { style = "width:100%" })
.DataTextField("Name")
.DataValueField("Id")
.OptionLabel(" ")
.FooterTemplateId("AddDataTemplate")
.Template("<span class=\"k-state-default\">#: Name #<p>#: Company # <br/>#: Email #<br/>#: UMobileDialingCode # #: UMobile #</p></span>")
.Filter(FilterType.Contains)
.DataSource(dataSource => dataSource
.Ajax()
.Read(r => r.Url("/DSContactDropDown/GetTransferee").Data("forgeryToken"))
.Events(e => e.Error("onError").RequestEnd("onRequestEnd"))
)
.Events(e => e.Change("TransfereeOnChange"))
.Value(Model.Job == null ? "0" : Model.Job.ITransfereeId == null ? "0" : Model.Job.ITransfereeId.ToString())
)
$.ajax({
            type: 'POST',
            url: '/User/SaveUser',
            beforeSend: function (xhr) {
                xhr.setRequestHeader("XSRF-TOKEN",
                    $('input:hidden[name="__RequestVerificationToken"]').val());
            },
            datatype: "html",
            data: $('#AddUserForm').serialize(),
            success: function (result) {
                var target = $('.storedDropdownID').val();
                var dropdownlist = $("#" + target).data("kendoDropDownList");
                //var dropdownlist = $("#" + target).getKendoDropDownList();
 
                //Rebind the Contact
                dropdownlist.dataSource.read();
                dropdownlist.refresh();
                dropdownlist.dataSource.sync();
 
                //select the new contact
                var value = result.userid;
                dropdownlist.value(value);
 
                //console.log("value " + value);
 
 
                //Close Modal
                $('#AddNewUserModal').modal('hide');
 
            },
            error: function (result) {
                console.log("error");
            }
        });
Aleksandar
Telerik team
 answered on 22 Nov 2019
9 answers
3.9K+ views

I have a grid, which needs to show conditionally formatted data, including colours.  All the custom formatting (percentages etc..)  is done by the model, with the grid simply displaying text fields. The colours are also passed to the grid as additional string fields.

 It's simple to format the fore colours, using a client template, but using the background style, the cell still retains an outline of the row background, which isn't what I want. What I have at the moment is:-

 

col.Bound(o => o.Apr).Title("Apr").ClientTemplate("<div style='background:#=Apr_BackCol#; color:#=Apr_Col#'>#=Apr#</div>");

 

How can I set the cell background? Ideally this would be via the client template, as I've got 17 columns which will need formatting like this, so calling a JavaScript function for each column seems unwieldy, especially since all the logic has been performed in the model.

 

Thanks

Martin
Telerik team
 answered on 22 Nov 2019
6 answers
112 views

I have managed to get the searching to work with our existing systems however i have noticed that if items with the same "Value" are returned at different levels. For example, if i am looking for people by their username/name so if i have a person named "sysadmin" who is also part of a group called "Administrators" they are returned at two different levels within the tree and selecting both of them results in the selection appearing multiple times within the textbox. Is there some way that i can link these two (or more) items?

 

The other problem i am having is that when data is fetched from the server, we also provide an indicator that there are more matched results that are not returned in the search (because we are only displaying the first 20). The total number of matched results is returned as part of the response.

e.g.

{
  "Data": [/* 20 items */],
  "Total": 223
}

 

In our other dropdownlist selectors we use virtual scrolling to continuously fetch more results and in our grid and list view pages we use paging.

Is there some way that i can indicate to a user that there are more items that could have been returned but weren't? Either by including some sort of paging functionality or appending an indicator of some kind to the item list.

Plamen
Telerik team
 answered on 20 Nov 2019
2 answers
1.6K+ views

I have a Kendo MVC dropdown list that looks like what you see below. I would like to set the background color of each item in the list based on information contained in the Employee entity being returned from the read operation. Note, I won't be able to use any sort of class to do this because I won't know ahead of time what the color should be. The color will be contained in each Employee entity returned. Can this be done?

                @(Html.Kendo().DropDownListFor(m => m)

                    .Name("EmployeeDropDown")
                    .DataTextField("DropDownText")
                    .DataValueField("RowId")
                    .OptionLabel("Select Employee...")
                    .AutoBind(false)
                    .Filter("contains")
                    .HtmlAttributes(new { style = "width: 525px" })
                    .DataSource(source =>
                    {
                        source.Read(read =>
                        {
                            read.Action("GetEmployeesForDropDown", "Employee");
                        })
                        .ServerFiltering(true);                                     // Let's do server side filtering
                    })
                    .Events(e => {
                        e.Select("onSelect");
                    })

Randy
Top achievements
Rank 1
 answered on 20 Nov 2019
3 answers
952 views

In my MVC grid code, I have the following:

.DataSource(dataSource => dataSource
   .Ajax()
   .Batch(false)
   .PageSize(25)
   .Events(events => events.Error("gridErrorHandler")) 
   .Events(events => events.RequestEnd("onRequestEndCertification(\"employeeCertificationGrid\")"))
   ...
)

As you can see, I have both an error handler and a RequestEnd handler. However, in my RequestEnd handler function, I would like to be able to check for any error which may have occurred during the event, before I proceed. I cannot find a way, from within the RequestEnd handler, to detect if any error occurred in the operation. Is there a way?

I did notice an e.response.Error object but it never seems to contain any information.

 

 

 


 

 

Petar
Telerik team
 answered on 20 Nov 2019
1 answer
93 views

I have a function like so

<script>
    function refreshMsInvoiceData1() {
        var ms = $("#msInvoicesAPV").data("kendoMultiSelect");

        var dataSource = new kendo.data.DataSource({
            transport: {
                read: function () {
                    $.ajax({
                        url: "/Invoices/GetInvoicesByDateTimeRange",
                        contentType: "application/json; charset=utf-8",
                        data: getDateTimeRangeParameters(),
                        success: function (result) {
                            // notify the data source that the request succeeded
                            console.log("success: ", result);
                        },
                        error: function (result) {
                            // notify the data source that the request failed
                            console.error("error: ", result);
                        }
                    });
                }   
            }
        });
        dataSource.fetch();
        console.log('datasource: ', dataSource);

        ms.setDataSource(dataSource);      

        console.log("ms", ms);
    }
</script>

 

I am calling this js function everytime there is a change in my selected date time range, I was able to see the data in the console logs but it is not updating the multiselect

Here is my multiselect

                                    @(Html.Kendo().MultiSelect()
                                        .Name("msInvoicesAPV")
                                        .Placeholder("Select invoices...")
                                        .HtmlAttributes(new { required = "required", style = "width: 100%", validationmessage = "Select Invoice Numbers." })
                                        .DataTextField("Number")
                                        .DataValueField("Id")
                                        .AutoBind(true)
                                    )

what am I doing wrong?

Petar
Telerik team
 answered on 19 Nov 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?