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

Hello I use in my form grid where I want to have checkbox selection.

I'm still lost how to bind selected row to model property "bool PrintOP"

Here is my .cshtml

div class="table-responsive">
                @(Html.Kendo().Grid(Model.ProdOrderLines)
                .Name("#grid")
                .Editable(editable => {
                    editable.Mode(GridEditMode.InCell);
                })
                .DataSource(dataSource => dataSource
                .Ajax()
                .Batch(true)
                .Model(m =>{
                    m.Id(id=>id.ProdOrderLineId);
                    m.Field(id=>id.PrintOP);
                    m.Field(id=>id.OperationNumber).Editable(false);
                    m.Field(id=>id.OperationName).Editable(false);
                    m.Field(id=>id.Machine).Editable(false);
                    m.Field(id=>id.Recipe1).Editable(false);
                    m.Field(id=>id.Recipe1C).Editable(false);
                    m.Field(id=>id.Recipe2).Editable(false);
                    m.Field(id=>id.Recipe2C).Editable(false);
                    m.Field(id=>id.Recipe3).Editable(false);
                    m.Field(id=>id.Recipe3C).Editable(false);
                    
                }))
                .Columns(c=>{
                    c.Bound(c=>c.ProdOrderLineId).Hidden(true)
                        .ClientTemplate("#= ProdOrderLineId # <input type='hidden' name='ProdOrderLines[#=index(data)#].ProdOrderLineId' value='#= ProdOrderLineId #' />");
                    c.Select().Width(50);
                    c.Bound(c=>c.OperationNumber).Width(50);
                    c.Bound(c=>c.OperationName).Width(100);
                    c.Bound(c=>c.Machine).Width(100);   
                    c.Bound(c=>c.Recipe1).Width(100);
                    c.Bound(c=>c.Recipe1C).Width(100);
                    c.Bound(c=>c.Recipe2).Width(100);
                    c.Bound(c=>c.Recipe2C).Width(100);
                    c.Bound(c=>c.Recipe3).Width(100);
                    c.Bound(c=>c.Recipe3C).Width(100);
                })
                .Editable(ed => ed.Mode(GridEditMode.InCell)))
              <br />
              <br />
            </div>

What I would like to have is when user select row  change model property "PrintOP" to true or false for corresponding ProductLine[x]

I hope there is some solution?

Here is also model used in Form

public classOrderDetailViewModel
    {
        public string OrderID { get; set; }    
        public string  ProductName { get; set; }
        public float OrderLength { get; set; }
        public int COL { get; set; }=0;      
        public float CalcLength { get; set; }=0;
        public float RemainingPaste { get; set; }=0;
        public List<ProdOrderLineViewModel> ProdOrderLines {get;set;}
    }

 public classProdOrderLineViewModel
    {
        public int ProdOrderLineId { get; set; }
        public int OperationNumber { get; set; }
        public string OperationName { get; set; }
        public string Machine { get; set; }
        public string Recipe1 { get; set; }="";
        public string Recipe1C { get; set; }="";
        public string Recipe2 { get; set; }
        public string Recipe2C { get; set; }
        public string Recipe3 { get; set; }
        public string Recipe3C { get; set; }

        public bool PrintOP { get; set; }=false;

    } 

Many THX in advance for your help.

BR Mirek

Alexander
Telerik team
 answered on 30 May 2022
1 answer
95 views

Is there a way for ASP.NET Core grid to mark a column as NOT resizable? I mean, no way to resize that column, even if others are able to resize?

Please see this thread on SO.

The proposed solution should work does not matter is that column bound to a data or not, is the column last or first or not. Especially the case when the column is the last one and is a command column. Often such columns are of fixed length, cause buttons or commands are fixed. The actions column should not be moved or resized. However, if the column is pushed by others, the column could go out of the visible view. 

Aleksandar
Telerik team
 answered on 30 May 2022
1 answer
1.3K+ views

Hi, I am new to kendo grid and over all telerik, I am having issues populating the data.  

please check the code below. This is the simplest form.  

 

//cshtml view

 

@using Kendo.Mvc
@using Kendo.Mvc.UI
@model IEnumerable<Database.Station>
@{
    ViewBag.Title = "Records";
//    foreach(var v in Model)
//    {
//      var i=  v.Componenet;
//    }
}

@ViewBag.heading
<hr />


<hr />



@if (Model.Any())
{
    <div>

          @(Html.Kendo().Grid(Model) 
    .Name("grid")
    .Columns(columns => {
        columns.Bound(p =>p.ATA).Width(100);
        columns.Bound(p => p.Componenet).Width(100);
        columns.Bound(p => p.Description).Width(140);
        columns.Bound(p => p.DiskNumber);
        columns.Bound(p => p.SoftwareNumber).Width(150);
    })

    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        .Ajax()

        .Read(read => read.Action("Main", "Station"))
     )
)
    </div>
    }

 

//controller

  public IActionResult Main()
        {
            var stationList = new List<Station>();
            var station = new Station
            {
                ATA = "22",
                SoftwareNumber = "check",
                DiskNumber = "1234",
                Componenet = "AC",
                Description = "Description"
            };
            stationList.Add(station);

            var station2 = new Station
            {
                ATA = "29",
                SoftwareNumber = "check2",
                DiskNumber = "1235",
                Componenet = "Bike",
                Description = "Description"
            };
            stationList.Add(station2);
            return Json(stationList);

        }
    }

 

I also noticed following the instruction. it does not tell me to include any css or javascript or any javascript code in script section. so nothing of that natrure is included.  Below is the outcome of the nuget.  I have no css or other js file from kendo. 

 

And this is what i get

                  
Alexander
Telerik team
 answered on 27 May 2022
1 answer
341 views

Hi,

I would like to know if there's a way of displaying files that are already uploaded in the upload widget.
To make my inquiry clear, I want the upload widget to act as a table of the upload files it has already uploaded. The current behavior only shows the files that are added in the document at the moment  of uploading. Once you navigate out of the page and back the upload files array gets emptied.

Thanks in advance for any response!

Mihaela
Telerik team
 answered on 27 May 2022
1 answer
193 views

Our customers using the spreadsheet copy/paste values in the Spreadsheet (ASP. NET CORE)

 

Sometimes pasted decimal separator is ".", sometimes is the ",".

Is there a way to search and replace the pasted values from "," to ".", or, if not, to search and replace in Spreadsheet ?

Aleksandar
Telerik team
 answered on 27 May 2022
4 answers
1.3K+ 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.5K+ 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.0K+ 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
624 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
219 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?