Telerik Forums
UI for ASP.NET MVC Forum
6 answers
149 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.8K+ 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
1.0K+ 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
139 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
1 answer
268 views

I am using telerik asp.net mvc and I have a multi select:

                                @(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)
                                                .DataSource(source =>
                                                    {
                                                        source.Read(read =>
                                                        {
                                                            read.Action("GetInvoicesByDateTimeRange", "Invoices")
                                                            .Data("getDateTimeRangeParameters");
                                                        })
                                                        .ServerFiltering(true);
                                                    })
                                )

now it is reading from a controller called Invoices and the action name is GetInvoicesByDateTimeRange

 

        public ActionResult GetInvoicesByDateTimeRange(string start, string end)
        {
            var session = Session["AccessToken"];

            try
            {
                DateTime startRange = Convert.ToDateTime(start);
                DateTime endRange = Convert.ToDateTime(end);

                string query = $"Type == \"ACCPAY\" AND Date >= DateTime({startRange.Year},{startRange.Month},{startRange.Day})" +
                    $" AND Date <= DateTime({endRange.Year},{endRange.Month},{endRange.Day})";

                var invoices = _xeroCoreApi.Invoices.Where(query).Find();

                return Json(invoices, JsonRequestBehavior.AllowGet);
            }
            catch (RenewTokenException e)
            {
                return RedirectToAction("Connect", "XeroOAuth");
            }
        }

as you can see, whenever it went to the catch part, I am redirecting it to another Action and controller

 

        public ActionResult Connect()
        {
            var authorizeUrl =  _authenticator.GetRequestTokenAuthorizeUrl(_user.Name);

            return Redirect(authorizeUrl);
        }


but I am getting errors of :
"Access to XMLHttpRequest at 'https://api.xero.com/oauth/Authorize?oauth_token=KNFURSOK8ZPTF1AMUKYQHT2E85FPTQ&scope=' (redirected from 'http://localhost:57141/Invoices/GetInvoicesByDateTimeRange?start=5%2F9%2F2019&end=11%2F19%2F2019') from origin 'http://localhost:57141' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request."

do I need to add "Access-Control-Allow-Origin:" as a header of the read property? if so how do I add it?

Veselin Tsvetanov
Telerik team
 answered on 19 Nov 2019
7 answers
3.1K+ views

Hi,

I want to find out all the kendo dropdown lists on a page. I want to write a common function in a .js file where I can perform this feature. I am using the below version of Telerik

 

Version: 2019.2.619.545 (Kendo Web Extensions for ASP.NET MVC)

MVC version: 5.0

IDE: Visual Studio 2015

Browser : Chrome  76.0.3809.100, IE 11.0

.Net Framework: 4.6.2

Programming Language: C#

I tried to use the approach provided at https://stackoverflow.com/questions/21513056/finding-all-kendo-drop-downs-on-page but it's not working.

Petar
Telerik team
 answered on 18 Nov 2019
5 answers
487 views

In my Kendo MVC grid, I have code as follows to place Edit and Destroy icons in a table cell:

columns.Command(command => { command.Edit().Text(" "); command.Destroy().Text(" "); }).Width(86);

 

I've attached a file that shows the result of this. As you can see, the container for the icons are much larger than they need to be and I have to devote almost 90 pixels to the column just to prevent the icons from wrapping. Is there a way I can make the icon containers smaller?

 

Nikolay
Telerik team
 answered on 15 Nov 2019
2 answers
935 views

Hi,
I'm new to Telerik, and there's a lot about MVC that I'm still learning, so apologies in advance.
I have a Grid Control that I'm passing an object to (see code below).  I want a detail page which is a little complex and beyond the scope of what a popup would handle, so a separate page is necessary.

I'm really struggling to get a "Select" button working to send route value out, something like /Person/Details/5
The grid itself is working as expected, however I can't seem to invoke a route or action based on the current selected row or invoke an action on the select button.
 
I've written a comment in the actual section I'm having a problem with. 
 
Thanks

@(Html.Kendo().Grid(Model)
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(p => p.person.Title).Width(100);
            columns.Bound(p => p.person.Firstname);
            columns.Bound(p => p.person.Firstname);
            columns.Bound(p => p.person.Surname);
            columns.Bound(p => p.person.ABN).Width(210);
            columns.Bound(p => p.person.PracticeCode);
            columns.Bound(p => p.currentform);
            columns.Command(command => { command.Edit();  });
            columns.Command(command => { command.Destroy();  });
            columns.Command(command => { command.Select(); });
        })
    .Sortable()
    .ToolBar(commands => commands.Create())
    .Editable(editable => editable.Mode(GridEditMode.PopUp))
    .DataSource(dataSource => dataSource
        .Server()
        .Model(model => model.Id(p => p.person.pkey))
        .Create(create => create.Action("Create", "Person"))
        // I'm having trouble with this next line.
        //  All I want is the drkey to be a route value
        // Obviously, this doesn't work because you can't put a lamba in the anonymous type, but how do you do it ?
        .Read(read => read.Action("Details", "Person", new { id = (p => p.person.pkey) } ))
        .Update(update => update.Action("Update", "Person"))
        .Destroy(destroy => destroy.Action("Destroy", "Person"))

Tsvetomir
Telerik team
 answered on 15 Nov 2019
2 answers
99 views

I have a couple of Dropdownlist in columns of a grid, when the page is resized the DDLs are not being resized accordingly.

How can I hook them into the column width on the resize.

This is kind of a follow-up to this one:

https://www.telerik.com/forums/dropdownlist-in-a-non-editable-grid

 

Thanks

Alex
Top achievements
Rank 1
 answered on 14 Nov 2019
3 answers
662 views

The icon on my date picker is too high... it should be centered in the dropdown box.  What CSS do I need to modify to get it to look right?

 

 

Tsvetomir
Telerik team
 answered on 14 Nov 2019
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? 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?