Telerik Forums
UI for ASP.NET MVC Forum
0 answers
3 views

Hi, 

   I wonder if you could help. I have a Kendo UI grid that has 2 bool elements, this is a MVC core 3.1 project.  When I click on the Create or Update buttons on the Edit popup, nothing happens - no errors and the controller action is not being called. 

    I have code similar to the following code for the grid itself : 


@(Html.Kendo().Grid<MyObject>()
    .Name("MyGrid")
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(m => m.Id(e => e.Id))
        .PageSize(20)
        .Read(read => read.Action("Read", "ActionRead"))
        .Create(create => create.Action("Create", "ActionCreate"))
        .Update(update => update.Action("Update", "ActionUpdate"))
        .Events(events => events.Error("onError"))
    )
    .Columns(columns =>
    {
        columns.Bound(p => p.Name);
        columns.Bound(p => p.IsCompleteStatus).ClientTemplate("<input type='checkbox' #= IsCompleteStatus ? checked='checked' :'' # />"); 
        columns.Bound(p => p.IsPendingStatus);
columns.Command(command =>
        {
            command.Edit();
            command.Custom("Remove").Click("onRemove").Visible("isRemoveable").IconClass("k-icon k-i-delete k-icon-32");
            command.Custom("Restore").Click("onRestore").Visible("isRestorable").IconClass("k-icon k-i-reset k-icon-32");
        });
    })
    .ToolBar(toolbar => toolbar.Create().Text("Add Status"))
    .Editable(editable => editable.Mode(GridEditMode.PopUp))
    .GridDefaults()

And this is what I have in my view for the popup window: 

 


<form>
    <div asp-validation-summary="ModelOnly" class="text-danger"></div>
    <input asp-for="Id" type="hidden" />
    @Html.FormGroupFor(m => m.Name)
    @Html.EditorFor(m => m.IsCompleteStatus)  
  @Html.FormGroupFor(m => m.IsPendingStatus)
</form>

The popup displays fine. However clicking on the Create button (when I hit 'Add') or the Update button (when I click on 'Edit') does absolutely nothing, unless I actually check the checkbox. 

If it is a bool type, it also doesn't let me leave it empty, so it needs it checked all the time.

If it a bool? type, it doesn't let me interact with it at all - I cannot check the boxes, so no Create/Update either.    If I remove the checkboxes from the view, it displays and works fine.  Can you help please? Thank you 

Chandini
Top achievements
Rank 1
 updated question on 07 Dec 2021
1 answer
3 views

Hi

We have two applications, one is WPF application that reads some RadDocument (see below) and displays it to the screen in non-paged format (layoutMode=flow). The user can then edit it via a RadRichTextEditor, and when they save it, the output is saved in DB.

Then We have a ASP.NET MVC application that does the same thing, but converts it to Html first. But when the converter (seen below) tries to make RadDocument out of it, it adds all kinds of extra styling and changes it to paged instead of flow layoutMode. 

This is not what we want, but we cannot figure out how to avoid this behavior.

Here's a concrete example:

These are the two methods we use to convert From and to Html.

private string RadDocToHTMLConverter(string radDoc) {
	RadDocument doc = RadDocumentExtention.ToRadDocument(radDoc);
	var RTB_Provider = new Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
	var flow_Provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
	var doc_bytes = RTB_Provider.Export(doc);
	var flowDocuemnt = flow_Provider.Import(doc_bytes);
	string html = new HtmlFormatProvider().Export(flowDocuemnt);
	return html;
}

private string HTMLtoRadDocStringConverter(string html) {
	var RTB_Provider = new Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
	var flow_Provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
	var flowDocuemnt = new HtmlFormatProvider().Import(html);
	var doc_bytes = flow_Provider.Export(flowDocuemnt);
	var rtbDoc = RTB_Provider.Import(doc_bytes);
	return rtbDoc.ToStr();
}

The problem occurs when the input html string is put through the HtmlFormatProvider.

 

Example of data to and from DB:

This is what we get FROM our DB that then needs to be converted to html for display on mvc page:

<t:RadDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:t="clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents" xmlns:s="clr-namespace:Telerik.Windows.Documents.Model.Styles;assembly=Telerik.Windows.Documents" xmlns:r="clr-namespace:Telerik.Windows.Documents.Model.Revisions;assembly=Telerik.Windows.Documents" xmlns:n="clr-namespace:Telerik.Windows.Documents.Model.Notes;assembly=Telerik.Windows.Documents" xmlns:th="clr-namespace:Telerik.Windows.Documents.Model.Themes;assembly=Telerik.Windows.Documents" version="1.4" LayoutMode="Flow" LineSpacing="1.14999997615814" LineSpacingType="Auto" ParagraphDefaultSpacingAfter="0" ParagraphDefaultSpacingBefore="0" StyleName="defaultDocumentStyle">
  <t:RadDocument.Captions>
    <t:CaptionDefinition IsDefault="True" IsLinkedToHeading="False" Label="Figure" LinkedHeadingLevel="0" NumberingFormat="Arabic" SeparatorType="Hyphen" />
    <t:CaptionDefinition IsDefault="True" IsLinkedToHeading="False" Label="Table" LinkedHeadingLevel="0" NumberingFormat="Arabic" SeparatorType="Hyphen" />
  </t:RadDocument.Captions>
  <t:RadDocument.ProtectionSettings>
    <t:DocumentProtectionSettings EnableDocumentProtection="False" Enforce="False" HashingAlgorithm="None" HashingSpinCount="0" ProtectionMode="ReadOnly" />
  </t:RadDocument.ProtectionSettings>
  <t:RadDocument.Styles>
    <s:StyleDefinition DisplayName="Document Default Style" IsCustom="False" IsDefault="False" IsPrimary="True" Name="defaultDocumentStyle" Type="Default">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LineSpacing="1.14999997615814" SpacingAfter="0" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontFamily="Verdana" FontSize="10.6700000762939" FontStyle="Normal" FontWeight="Normal" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Normal" IsCustom="False" IsDefault="True" IsPrimary="True" Name="Normal" Type="Paragraph" UIPriority="0" />
    <s:StyleDefinition DisplayName="Table Normal" IsCustom="False" IsDefault="True" IsPrimary="False" Name="TableNormal" Type="Table" UIPriority="59">
      <s:StyleDefinition.TableStyle>
        <s:TableProperties CellPadding="5,0,5,0">
          <s:TableProperties.TableLook>
            <t:TableLook />
          </s:TableProperties.TableLook>
        </s:TableProperties>
      </s:StyleDefinition.TableStyle>
    </s:StyleDefinition>
  </t:RadDocument.Styles>
  <t:Section>
    <t:Paragraph>
      <t:Span FontWeight="Bold" Text="" />
      <t:Span Text=" " />
    </t:Paragraph>
    <t:Paragraph>
      <t:Paragraph.ParagraphSymbolPropertiesStyle>
        <s:SpanProperties FlowDirection="LeftToRight" />
      </t:Paragraph.ParagraphSymbolPropertiesStyle>
      <t:Span FontWeight="Bold" Text="" />
      <t:Span Text=" " />
    </t:Paragraph>
  </t:Section>
</t:RadDocument>

Then we convert it to html, (this works as expected) and displayed..

Then without editing anything but simply pressing save, taking the result of Kendo.Editor(), we get some html string that we put into the converter and get THIS result:

<t:RadDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:t="clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents" xmlns:s="clr-namespace:Telerik.Windows.Documents.Model.Styles;assembly=Telerik.Windows.Documents" xmlns:r="clr-namespace:Telerik.Windows.Documents.Model.Revisions;assembly=Telerik.Windows.Documents" xmlns:n="clr-namespace:Telerik.Windows.Documents.Model.Notes;assembly=Telerik.Windows.Documents" xmlns:th="clr-namespace:Telerik.Windows.Documents.Model.Themes;assembly=Telerik.Windows.Documents" version="1.4" LayoutMode="Paged" LineSpacing="1" LineSpacingType="Auto" ParagraphDefaultSpacingAfter="0" ParagraphDefaultSpacingBefore="0" StyleName="defaultDocumentStyle">
  <t:RadDocument.Captions>
    <t:CaptionDefinition IsDefault="True" IsLinkedToHeading="False" Label="Figure" LinkedHeadingLevel="0" NumberingFormat="Arabic" SeparatorType="Hyphen" />
    <t:CaptionDefinition IsDefault="True" IsLinkedToHeading="False" Label="Table" LinkedHeadingLevel="0" NumberingFormat="Arabic" SeparatorType="Hyphen" />
  </t:RadDocument.Captions>
  <t:RadDocument.ProtectionSettings>
    <t:DocumentProtectionSettings EnableDocumentProtection="False" Enforce="False" HashingAlgorithm="None" HashingSpinCount="0" ProtectionMode="ReadOnly" />
  </t:RadDocument.ProtectionSettings>
  <t:RadDocument.Styles>
    <s:StyleDefinition DisplayName="Document Default Style" IsCustom="False" IsDefault="False" IsPrimary="True" Name="defaultDocumentStyle" Type="Default">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties FirstLineIndent="0" LeftIndent="0" LineSpacing="1" RightIndent="0" SpacingAfter="0" SpacingBefore="0" TextAlignment="Left" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FlowDirection="LeftToRight" FontFamily="Verdana" FontSize="10.67" FontStyle="Normal" FontWeight="Normal" ForeColor="#FF000000" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition BasedOnName="Normal" DisplayName="Heading 3" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading3Char" Name="Heading3" NextStyleName="Normal" Type="Paragraph" UIPriority="9">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties KeepLines="True" OutlineLevel="3" SpacingAfter="0" SpacingBefore="13.3333330154419" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontWeight="Bold" ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 3 Char" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading3" Name="Heading3Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontWeight="Bold" ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition BasedOnName="Normal" DisplayName="Heading 4" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading4Char" Name="Heading4" NextStyleName="Normal" Type="Paragraph" UIPriority="9">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties KeepLines="True" OutlineLevel="4" SpacingAfter="0" SpacingBefore="13.3333330154419" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontStyle="Italic" FontWeight="Bold" ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 4 Char" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading4" Name="Heading4Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontStyle="Italic" FontWeight="Bold" ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition BasedOnName="Normal" DisplayName="Heading 5" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading5Char" Name="Heading5" NextStyleName="Normal" Type="Paragraph" UIPriority="9">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties KeepLines="True" OutlineLevel="5" SpacingAfter="0" SpacingBefore="13.3333330154419" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 5 Char" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading5" Name="Heading5Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition BasedOnName="Normal" DisplayName="Heading 6" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading6Char" Name="Heading6" NextStyleName="Normal" Type="Paragraph" UIPriority="9">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties KeepLines="True" OutlineLevel="6" SpacingAfter="0" SpacingBefore="13.3333330154419" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontStyle="Italic" ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 6 Char" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading6" Name="Heading6Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontStyle="Italic" ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition BasedOnName="Normal" DisplayName="Heading 7" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading7Char" Name="Heading7" NextStyleName="Normal" Type="Paragraph" UIPriority="9">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties KeepLines="True" OutlineLevel="7" SpacingAfter="0" SpacingBefore="13.3333330154419" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontStyle="Italic" ForeColor="#FF000000" ThemeFontFamily="major" ThemeForeColor="text1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 7 Char" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading7" Name="Heading7Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontStyle="Italic" ForeColor="#FF000000" ThemeFontFamily="major" ThemeForeColor="text1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Normal" IsCustom="False" IsDefault="True" IsPrimary="True" Name="Normal" Type="Paragraph" UIPriority="0">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontSize="16" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition BasedOnName="Normal" DisplayName="Normal (Web)" IsCustom="False" IsDefault="False" IsPrimary="False" Name="NormalWeb" Type="Paragraph" UIPriority="99">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties AutomaticSpacingAfter="True" AutomaticSpacingBefore="True" SpacingAfter="6.66666650772095" SpacingBefore="6.66666650772095" />
      </s:StyleDefinition.ParagraphStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Table Normal" IsCustom="False" IsDefault="True" IsPrimary="False" Name="TableNormal" Type="Table" UIPriority="59">
      <s:StyleDefinition.TableStyle>
        <s:TableProperties CellPadding="7,0,7,0">
          <s:TableProperties.TableLook>
            <t:TableLook />
          </s:TableProperties.TableLook>
        </s:TableProperties>
      </s:StyleDefinition.TableStyle>
    </s:StyleDefinition>
  </t:RadDocument.Styles>
  <t:Section>
    <t:Paragraph StyleName="NormalWeb">
      <t:Span FontWeight="Bold" Text="" />
      <t:Span Text=" " />
      <t:Span FontWeight="Normal" Text="" />
    </t:Paragraph>
    <t:Paragraph StyleName="NormalWeb">
      <t:Span FontWeight="Bold" Text="" />
      <t:Span FontWeight="Normal" Text="" />
    </t:Paragraph>
    <t:Paragraph StyleName="NormalWeb">
      <t:Span FontWeight="Normal" Text="" />
    </t:Paragraph>
    <t:Paragraph StyleName="NormalWeb">
      <t:Span FontWeight="Bold" Text="" />
    </t:Paragraph>
  </t:Section>
</t:RadDocument>

There are many issues here.

1. It has created LayoutMode to Paged instead of Flow, which looks wrong in the context we are using this for.

2. It adds all kinds of extra style like "NormalWeb" that we dont want or need. Makes the text bigger and adds margins, paddings and stuff that we dont want.

3. the converter code has barely any options or settings available, and the documentation is lacking at best.

 

The result we want to get out is the same as the original, so both applications can use it. Afterall we didn't edit anything, just converted it to and from html. Aka From RadDoc -> html -> RadDoc. So it should be the same, before and after.

HOW, can we fix this? If you could also provide examples, that would be great.

 

 

Dimitar
Telerik team
 answered on 07 Dec 2021
1 answer
10 views

Hello - I have a grid with a toolbar defined.  The grid is also coded to allow grouping.  The grouping option is visible, but not the toolbar.  If I disable grouping, the toolbar displays,  I have other grids coded very much the same in my project that work fine.  

What do I have wrong on this one?

Here is my code:

        <div class="row pt-4 d-none centered" id="qSecurityGridDiv">
            @(Html.Kendo().Grid<WSIPC.Web.Models_View.Security.QmlativSecurityUserList>()
                .Name("grid")
                .Columns(columns => {
                    columns.Bound(p => p.Id).Visible(false);
                    columns.Bound(p => p.UserName).Title("Username");
                    columns.Bound(p => p.LastName).Title("Last Name");
                    columns.Bound(p => p.FirstName).Title("First Name");
                    columns.Bound(p => p.Role).EditorTemplateName("DropDownRoles");
                    columns.Bound(p => p.Grade).Title("Grade Level");
                    columns.Bound(p => p.AssignedSchools).ClientTemplate("#= iterate(data)#").Title("Schools");                    
                    columns.Bound(p => p.Hsb).EditorTemplateName("DropDownIndicators").Title("HSB Access");
                    columns.Bound(p => p.HsbAdmin).EditorTemplateName("DropDownIndicators").Title("HSB Administrator Access");
                    columns.Bound(p => p.MsdAdmin).EditorTemplateName("DropDownIndicators").Title("MSD Administrator Access");
                })
                .ToolBar(toolbar =>
                {
                    toolbar.Save();
                    toolbar.Excel();
                    toolbar.Pdf();
                    toolbar.Custom().Text("Mass Change").HtmlAttributes(new { id = "massChangeQ" });
                })
                .Pdf(pdf => pdf.ProxyURL(Url.Action("Excel_Export_Save", "Grid")).AllPages().FileName("Msd Security Grid"))
                .Excel(excel => excel.ProxyURL(Url.Action("Excel_Export_Save", "Grid")).AllPages(true).FileName("Msd Security Grid"))
                .AutoBind(false)
                .Pageable()
                .Sortable()
                .Scrollable()
                .Groupable()
                .Reorderable(reorder => reorder.Columns(true))
                .Editable(editable => editable.Mode(GridEditMode.InCell))
                .Filterable()
                .HtmlAttributes(new { style = "height:750px;" })
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Batch(true)
                    .PageSize(100)
                    .Read(read => read.Action("GetSecurityUsersFilteredGrid", "MsdQmlativSecurity").Data("additionalInfo"))
                    .Model(model =>
                    {
                        model.Id(p => p.Id);
                        model.Field(p => p.UserName).Editable(false);
                        model.Field(p => p.LastName).Editable(false);
                        model.Field(p => p.FirstName).Editable(false);
                        model.Field(p => p.Grade).Editable(false);
                        model.Field(p => p.AssignedSchools);
                    })
                    .Update("UpdateSecurityGridGroup", "MsdQmlativSecurity")
                    .Events(e => e.Sync("sync_handler"))
                 )
                .Events(events => events.Edit("onEdit"))
            )
        </div><!-- end grid row-->
     

I've attached screen shots with grouping enabled and with it not.

Thanks for any help.

 

Lisa

Anton Mironov
Telerik team
 answered on 07 Dec 2021
0 answers
5 views

Hi all,

I started working with Blazor few weeks ago and recently got introduced to Telerik UI for Blazor so I started making a CRUD to learn.

After coding the update function I tested the app and got this error when I tried to update a register:

The instance of entity type 'Familia' cannot be tracked because another instance with the same key value for {'CodiFamilia'} is already being tracked.

To solve that I added "AsNoTracking" to the Entity Framework Core query located in "ReadList", it worked the first time but the app crashed after the second update. Afterwards I implemented an alternative solution which consists on finding the object by its ID and updating every parameter one by one which worked since it's not using the same object.

I'm wondering if there is any way to implement a functional update which resembles the first solution because the second one is pretty bad if there are many parameters to update.

Thanks in advance.

Jack
Top achievements
Rank 1
 asked on 06 Dec 2021
0 answers
8 views

Hi Team,

I am using Kendo UI MVC Grid and trying to override the checkbox style using FontAwesome fonts. I thought of doing it through CSS alone but since we can't select parent selector through CSS I ended up using the filterMenuInit event. 

Grid column is configured using:-

.Filterable(f => f.Multi(true).Search(true));

I am adding another label to the rendered checkbox text using the below function:-


 function addCustomLabel(e) {
            var container = e.container;
            var allCheckboxes = $("input[type='checkbox']", container);
            $.each(allCheckboxes, function (id) {
                $(this).attr("id", 'chk' + id).addClass("blueCheckbox");
                var checkbox = $(this)[0];
                console.log(checkbox);
                var parentLabel = $(this).parent('label');
                var labelText = parentLabel.text();
                parentLabel.empty();
                parentLabel.append(checkbox);
                parentLabel.append("<label for='"+ 'chk' + id +"'>" + labelText + "</label>");
            });
        }
It's working as expected i.e. adding an id to checkbox and label with "for" attribute but only the "Select All" checkbox is not working. I am assuming it's because kendo is checking for text "Select All" which is now wrapped inside a label. Could you please suggest a fix for this? Or please let me know if there is any better way to do this. 
Rahul
Top achievements
Rank 1
 updated question on 05 Dec 2021
1 answer
18 views

I am using mvc and using the server as a datasource.  I am trying to change the color of the column based on the value  . I tried to many finding on the net but none is working see at least two of them in the code below.   

 

//This example doesn't do anything.

columns.Bound(p => p.balance).Width(120).Sortable(false).Template(@<text>
                                                                                       @if (item.balance< 0)
                                                                                       {
                                                                                           <div style="background-color: Red;">
                                                                                               @item.balance;

                                                                                           </div>
                                                                                       }
                                                                                       else
                                                                                       {
                                                                                           <div style="background-color: Green;">
                                                                                               @item.amount_residence
                                                                                           </div>
                                                                                       }
                                                                                    </text>);

       //This below example throw an error

@(Html.Kendo().Grid(Model)
    .Name("grid").CellAction(cell =>
    {
        if (cell.Column.Title.Equals("balance"))
        {
            if (cell.DataItem.balance != null && cell.DataItem.balance.Value < 0)
            {
                cell.HtmlAttributes["style"] = "background-color: red";
            }
        }
    })
    .Columns...
Ivan Danchev
Telerik team
 answered on 01 Dec 2021
1 answer
11 views

Hi Sir, 

In the MVC scheduler, I want to change the text of the SAVE button to text when I am using the addEvent functionality. It is simply a create appointment template.

I am doing like this and it is not working-

$('.k-edit-buttons k-state-default k-button k-primary k-scheduler-update k-button-text').text("Confirm");

 

Could you please suggest to me how I change the text of that button?

For your reference, I am attaching the screenshot so that you will get to know where I want to change, and I will also put a screenshot of the coding.

Petar
Telerik team
 answered on 30 Nov 2021
1 answer
10 views

Simple question: what NuGet files and namespaces contain the "ToPagedList" methods?

Detail:

New to Telerik, new to these Forums, but thrilled they are here. I have what SHOULD be a simple question...

Web Application written 4 years ago using Telerik ASP.NET MVC (I think) and Telerik Kendo (I think). The 2017 App is running in production, but I need to make changes in the code (new feature stuff). Meanwhile, the guy who wrote it is no longer here - there is no one left who has touched it. Undocumented, of course. And we have moved from Visual Studio 2017 to Visual Studio 2019.

So I am trying to get the application to build pretty much "as is" so I can tinker with it and see how it works, and figure out exactly where I need to make changes. First build had 274 errors, then 64 errors... now down to 1 error in two places in one class; a reference to "ToPagedList" which is a method apparently used to pluck a specified page or pages from a result set for rendering (in a Grid?). Virtually all of that was uninstalling and reinstalling NuGet files because somehow they lost their initialization in the app files. So, plenty of places I could have gone awry.

"ToPagedList" works on a View derivative class; but apparently I am not including the proper Telerik references and libraries to get these two references to "ToPagedList" to resolve. Probably have some class confusion as well (something referencing Microsoft instead of Telerik). 

The first of the two errors, other is basically identical in the same class:

Severity Code Description Project File Line Suppression State
Error CS1061 'IQueryable<IncidentDetailView>' does not contain a definition for 'ToPagedList' and no accessible extension method 'ToPagedList' accepting a first argument of type 'IQueryable<IncidentDetailView>' could be found (are you missing a using directive or an assembly reference?) QCWeb D:\QCWeb\QCWeb\Controllers\ReportController.cs 248 Active

Line 248 looks like:

return View(tickets.ToPagedList(pageNumber, pageSize));

where tickets is an instantiation of the "IQueryable<IncidentDetailView>",

and IncidentDetailView is partial class that contains the Entity Framework record field definitions for a database pseudo-table (query results).

If I could figure out which Telerik library that this method is defined in, I can probably work back to get other references properly aligned as well (ever the optimist). I am just not having much luck searching the Telerik documentation for class method lists and descriptions, nor am I having much luck playing library roulette. Any ideas?  Thanks!!

Ivan Danchev
Telerik team
 answered on 29 Nov 2021
0 answers
12 views

Hi,

We have a scheduler with two views - a week view and a timeline view.  When in the week view all events seem to show - however when in the timeline view any event that finishes on the day in question disappears.  The start date does not seem to matter.  For events that cross days they appear on any day that isnt the end date - so for example if i have an event that starts Monday through to Thursday the event will show on Monday, Tuesday and Wednesday but not Thursday.  Navigating to Thursday does display the event briefly but then the event disapears.  

The Razor code for the scheduler is:

 


@(Html.Kendo().Scheduler<F0CUSWeb.Models.PlanningScheduleViewModel>()
                .Name("apptScheduler")
                .AutoBind(true)
                .HtmlAttributes(new { style = "height: 80vh;" })
                .MajorTick(120)
                .Editable(editable =>
                {
                    editable.Destroy(false);
                    editable.Move(false);
                    editable.Resize(false);
                    editable.Confirmation(true);
                })
                .Views(views =>
                {
                    views.TimelineWeekView(timeline =>
                    {
                        timeline.DateHeaderTemplate("<span class='k-link k-nav-day'>#=kendo.toString(date, 'ddd dd MMM yy')#</span>");
                        timeline.MajorTimeHeaderTemplate("<span class='k-link k-nav-day' style='font-size:12px'>#=kendo.toString(date, 'HH:mm')#</span>");
                        timeline.Title("Week View");
                        timeline.ColumnWidth(30);
                        timeline.MajorTick(480);
                        timeline.WorkDayStart(new DateTime(2010, 1, 1, 0, 0, 0));
                        timeline.WorkDayEnd(new DateTime(2010, 1, 1, 23, 59, 59));
                        timeline.ShowWorkHours(false);
                    });
                    views.TimelineView(timeline =>
                    {
                        timeline.DateHeaderTemplate("<span class='k-link k-nav-day'>#=kendo.toString(date, 'ddd dd MMM yy')#</span>");
                        timeline.MajorTimeHeaderTemplate("<span class='k-link k-nav-day' style='font-size:12px'>#=kendo.toString(date, 'HH:mm')#</span>");
                        timeline.Title("Day View");
                        timeline.StartTime(new DateTime(2010, 1, 1, 6, 0, 0));
                        timeline.EndTime(new DateTime(2010, 1, 1, 20, 0, 0));
                        timeline.ColumnWidth(20);
                        timeline.MajorTick(60);
                    });
                })
                    .Events(e =>
                    {
                        e.DataBound("apptSchedulerBound");
                        e.Navigate("onSchedulerNavigate");
                    })
                    .DataSource(ds =>
                    {
                        ds.Events(events =>
                        {
                            events.Error("endAnimation");
                        });
                        ds.Read(read => read.Action("GetSchemeSchedule", "Planning").Data("schemeScheduleString"));
                    })
                    .Group(group => group.Resources("Gang").Orientation(SchedulerGroupOrientation.Vertical))
                    .Resources(resource =>
                    {
                        resource.Add(m => m.Gang)
                            .Title("Gang")
                            .Name("Gang")
                            .DataSource(ds => ds
                                .Custom()
                                .Transport(transport => transport.Read(read => read.Action("GetGangsForSchemePlanning", "Planning")/*.Data("getGangsForAppts")*/))
                                .Schema(s => s
                                    .Data("Data")
                                    .Total("Total")
                                    .Model(m =>
                                    {
                                        m.Id("ID");
                                        m.Field("Name", typeof(string));
                                    })))
                        .Multiple(true)
                        .DataValueField("ID")
                        .DataTextField("Name");
                    })
                    .EventTemplateId("eventTemplate")
            )

 

Any help would be appreciated as it is driving us mad!

 

Thanks

 

Michael
Top achievements
Rank 1
 asked on 26 Nov 2021
1 answer
15 views

HI I am using asp.net mvc .net (not core).  I have a grid which has paging . Pagig size is 20.  Now lets say I have functionality for download excel file and pdf file.  When user click on the download I want to download all the data not just what user see on the particular page. 

 

Thanks

 

Ivan Danchev
Telerik team
 answered on 26 Nov 2021
Top users last month
Bernd
Top achievements
Rank 2
Iron
Iron
Iron
Benedikt
Top achievements
Rank 2
Iron
Veteran
Iron
Richard
Top achievements
Rank 2
Iron
Iron
Iron
Peter
Top achievements
Rank 1
Veteran
Iron
Salma
Top achievements
Rank 1
Iron