Telerik Forums
UI for ASP.NET Core Forum
4 answers
1.4K+ views

Hello,

I am working on an application that the client has just added additional filter criteria beyond what grid filter provides.

I believe I might be able to do this using the example here Create Filter Widgets with Multiple Filter Criteria | Kendo UI Grid for jQuery | Kendo UI for jQuery (telerik.com) - maybe. I'm using ASP.Net Core 5 Razor pages so sometimes examples don't always work.

All of the fields (except for a couple that are date fields) are char or text type columns in the database.  The client wants to be able to use functions like "greater than", "in",  and "Is one of".  (I know greater than is not going to give them what they think) but the In condition or the Is One of condition they say are needed.

The filter now for 2 items is not enough.

For example, they need to filter for several POs at once - as you might do with a sql query SELECT * FROM tableaname WHERE fieldname in ('po1', 'po1', 'po3', 'po4') as an example.  none of the data is sequential so the need for "IN" or "IS ONE OF" filtering conditions.

Is this possible?

How would it be coded and handled on the backend?

Are the available filters documented somewhere here on the site?

Can we use wild cards in the filter value?  As when the search condition may vary inside the string and not with the start or end with characters?

thanks!

Marianne
Top achievements
Rank 1
Iron
Iron
 answered on 24 May 2022
2 answers
1.7K+ views

Hello all,

Could someone point me to an example or suggest the best approach for this? The application is asp.net core 5 using Razor.

I am using GridColumnSettings in my grid because there is one SQL table to populate many different pages & we change elements based on the context of use.

On one page, we've added a custom function to the filtering for one column so that we can provide a SQL "IN" condition.  This is working great. However for that one column, can someone suggest how to provide a custom filter menu so that we restrict what options are provided. (Users are going to be confused if they have options on the filter menu that do not work as they expected...)

I've tried a few examples found from searching this site but none seem to work.  Either I got it wrong (for possible) or  because of the columns.LoadSettings<Model.columns> from the server side, it doesn't execute any client side code on the .cshtml page.

I've included the relevant code below.

Any suggestions or examples will be greatly appreciated.  Thank you.

This is the grid on the .cshtml page.

<div id="griddiv">
    @(Html.Kendo().Grid<HPK_DATA>(Model.testdata)    
    .Name("grid")
    .Columns(columns => {
       columns.LoadSettings(Model.columns);
    })
    .Events(ev=>{
        ev.Filter("onFilter");
        //ev.FilterMenuInit("filterMenuInit");
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Read(read => read.Url(Url.Action()+"?handler=Read").Data("forgeryToken"))
     )
)
</div>

This is a portion of the gridcolumnsetting code for brevity.  The column that needs a custom filter menu is the SERIAL_NO.

  IList<GridColumnSettings> columns = new List<GridColumnSettings>
 {
                  new GridColumnSettings
            {
                Member = "ROWID",
                Title = "Id",
                Visible = false,
                Width = "15px",
                Filterable = true

            },
                   new GridColumnSettings
            {
                Member = "ITEM_NO",
                Title = "Item No.",
                Visible = true,
                Width = "150px",
                Filterable = true

            },
                     new GridColumnSettings
             {
                Member = "SERIAL_NO",
                Title = "Serial No.",
                Visible = true,
                Width = "150px",
                Filterable = true
                               
            },
Marianne
Top achievements
Rank 1
Iron
Iron
 answered on 24 May 2022
1 answer
1.1K+ views

What is required to filter a grid on a DateTime without specifying the time?
i.e.: I want to see all records for a date.  All for 2022-05-18 regardless of the time.

Or do you have to specify the date using identifying greater than and less than?  i.e.: > 2022-05-17 and < 2022-05-19

Mihaela
Telerik team
 answered on 24 May 2022
1 answer
685 views

Is there a way to hide or prevent a tooltip from showing if there is no content?

What I'm trying to do is prepopulate fields in a View with Tooltips (so I don't have to code them in later).

Tool tips are then obtained in the Controller from a ToolTip File which would contain Content and Width.  If there is no content for the field in the ToolTip file, I don't want the tool tip to show.  Right now, if Content is NUL and Width is 0 (zero) then you get a small black box as shown in the attached picture

Petar
Telerik team
 answered on 23 May 2022
1 answer
238 views


This changes the loading image on my datagrid.  However, its huge.  How do I resize this down to something reasonable?  So, I need to show a gif 125px X 125px inside a grid that is about 1100px X 550px.  Right now it seems the gif is resized to fit the entire area.
<style>

.k-loading-image:before,
.k-loading-image:after {
    display: none !important;
}

.k-loading-image {
    background: url('./images/Busy/SmallV1.gif') center center no-repeat;
}
</style>

Petar
Telerik team
 answered on 23 May 2022
1 answer
170 views

Hi there

I have a grid with draggable functionality but if I enable the default sort the drag & drop won't work any more.

 

I'm setting the default sort in jquery:

grid.dataSource.sort({ field: "Id", dir: "asc" });

 

I've tried to do it in C# code but got the same results.

 

Can anyone help me with it ?

 

Thanks

Stoyan
Telerik team
 answered on 20 May 2022
1 answer
1.0K+ views

After updating a working .NET 5 project to .NET 6 and upgrading Nuget package Telerik.UI.for.AspNet.Core from 2021.2.511 to 2022.2.510, I am now receiving an error using IntegerTextBoxFor on an object property model. The error is

FileNotFoundException: Could not load file or assembly 'Microsoft.DotNet.InternalAbstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

 

Below are screen shots of:

  1.  The exception
  2.  The Nuget packages 1.) From the .NET 5 working solution and 2.) from the .NET 6 solution that crashes.
  3. The line of code that causes the exception. Note that if I bind to a simple property instead of a complex object property, the error does not happen.



Nuget Package Telerik.UI.for.AspNet.Core

The Nuget package on the left is referencing version 2021.2.511. As you can see, that version includes a reference to the file that is causing the error, which is Microsoft.DotNet.InternalAbstractions. The package on the right is referencing the latest version 2022.2.510 and that package does not include the file that is causing the error.

 


@(Html.Kendo().IntegerTextBoxFor(x => x.Product.Odometer)
    .Min(0)
    .Culture(Localizer.CultureCode)
 )

 

If this file is still a dependency of that particular Telerik package, why is it missing? And please advise on how to fix this.

Thank You,
dbeard

Mihaela
Telerik team
 answered on 20 May 2022
1 answer
281 views

We have a grid of data items that we are editing with a custom popup editor. In the popup is a dropdown list to a foreign key field. When we're editing we need the dropdown list to contain all items so that the existing values show correctly but when we're adding a new record the dropdown list must only show the items in the dropdown where the parent entity does not already have a record associated with that related entity.

So, an example scenario is we have a list of companies and a list of products and some companies have discounts for certain products - a separate company discount table. We navigate to a view with a grid of discounts for a chosen company. In the list of company discounts there is a foreign key to the product. When an edit of one of these discount records is performed the popup opens and the dropdown is populated with all products and the dropdown is made readonly. When a new "discount" record is added, the popup opens and it needs to filter the dropdown items to just those products where the company doesn't already have a discount. We have all the controller code deriving the correct data but we have an issue. When the popup opens for an edit the dropdown data source "read" action executes but at that point in time the id of the parent object hasn't been initialised so it always looks like we are adding a new record - the id is showing as 0. We've added an additional call to the datasource.read on document.ready effectively forcing it to derive the data twice and that then populates the dropdown successfully but it no longer seems to be bound to the field as the current value is not selected. Additionally, when we open the popup for a new record we need to pass in the company id which we know from the grid view but can't seem to get to populate the model object that the popup is bound to. I've searched the web and forums and so far not managed to find a matching scenario. Do you have some advice on how to resolve these issues?

Thanks in advance

Alexander
Telerik team
 answered on 20 May 2022
2 answers
213 views
How do I print from the image editor?  To open a broader discussion... do I need to pull the image then wrap it in a PDF in order to print?  If so, how?
Aleksandar
Telerik team
 answered on 20 May 2022
0 answers
127 views

Keep in mind that I am new to .Net Core 6.0, ASP.Net and the newest Telerik tools!  I have very little experience with js and Razor but am learning quickly!

With that said:  I would like to create an input form for collecting search information.  I have created a slide out window from the right side...  I just can't find a good example of how to add input objects to the form!  Any suggestions of research documents would be greatly appreciated!

 

Current Html & js defining form:

 <div id="dialog"></div>

 $("#dialog").kendoWindow({ title: "IVM - Search Engine", 
                                   width: "40%", 
                                   height: "85%", 
                                   actions: [ "close" ], 
                                   draggable: false, 
                                   resizable: false, 
                                   modal: true, 
                                   position:{ top: 75, left: "50%" }, 
                                   //content: { url: "Address/getTypes",
                                   //           dataType: "json",
                                   //           iframe: false }
                                   //item:{ kendoComboBox:{name:"cmbaddressTypes", dataSource:@AddressTypes.addressTypes }}
                                   animation: { open: { effects: "slideIn:left", duration: 500 }, 
                                                close: { effects: "slideIn:left", reverse: true, duration: 500 } }, 
                                   visible: false })

The AppBar declaration placing the search button on the bar.

 @(Html.Kendo().AppBar()
        .Position(AppBarPosition.Top)
        .PositionMode(AppBarPositionMode.Fixed)
        .Name("appbar")
        .Items(items=> {
            items.Add().Template("<a class='k-button k-toggle-button k-button-flat-base k-button-flat k-button-md k-rounded-md k-icon-button' href='\\#'><span class='k-icon k-i-menu'></span></a>").Type(AppBarItemType.ContentItem);
            items.Add().Type(AppBarItemType.Spacer).Width("16px");
            items.Add().Template("<h3>International Vending Machines</h3>").Type(AppBarItemType.ContentItem);
            items.Add().Type(AppBarItemType.Spacer).Width("800px");
            items.Add().Template("<a class='k-button k-search-button k-button-flat-base k-button-flat k-button-md k-rounded-md k-icon-button' href='\\#' id='openWindow'><span class='k-icon k-i-search'></span></a>").Type(AppBarItemType.ContentItem);
        })
        .Deferred()
    )

and finally, the delegate and event:

        $("#appbar").on("click", ".k-search-button", function (e) { IVMSearch(e); })

    <script>
        function IVMSearch(e)
        { var dialog = $("#dialog").getKendoWindow();
          dialog.open(); }

    </script>

The behavior is:  when the search button is clicked, this kendoWindow slides out from the right side and this is where I want the user to enter their search criteria.  I need kendoCombobox, kendoText, kendoButton and kendoLabel objects on this slide out....  

Alan
Top achievements
Rank 2
Iron
Iron
 asked on 19 May 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?