Telerik Forums
UI for ASP.NET MVC Forum
1 answer
547 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
484 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
1 answer
1.8K+ 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
142 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
323 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
104 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
122 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
1 answer
106 views

I'm trying to create a 3 level hierarchy grid, but for some reason the second level doesn't show the expand button.

The only reason the 3rd level is expanded in the pic is because of the dataBound script, which expands everything.

How do I make the second level expandable?

Here's the code:


@(Html.Kendo().Grid(Model.SalaryApprovalEmployments) .Name("grid") .Columns(columns => { columns.Bound(e => e.Id).Width(100); columns.Bound(e => e.TotalCost).Width(100); columns.Bound(e => e.Trend).Width(100); }) .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(sae => sae.Id); }) .ServerOperation(false) ) .Events(events => events.DataBound("dataBound")) .ClientDetailTemplateId("salaryCodeTemplate") .HtmlAttributes(new { style = "width:600px;" }) ) <script id="salaryCodeTemplate" type="text/kendo-tmpl"> @(Html.Kendo().Grid<SalaryApprovalTransactionDTO>() .Name("grid_#=Id#") .Columns(columns => { columns.Bound(o => o.SalaryApprovalEmploymentId).Width(100); columns.Bound(o => o.SalaryCodeId).Width(100); columns.Bound(o => o.Amount).Width(100); }) .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(sat => sat.SalaryCodeId); }) .Read(read => read.Action("HierarchyBindingTransactions", "SalaryApproval", new { salaryApprovalGroupId = Model.Id, salaryApprovalEmploymentId = "#=Id#" })) ) .Events(events => events.DataBound("dataBound")) .ClientDetailTemplateId("transactionTemplate") .ToClientTemplate() ) </script> <script id="transactionTemplate" type="text/kendo-tmpl"> @(Html.Kendo().Grid<SalaryApprovalTransactionDTO>() .Name("grid_#=SalaryApprovalEmploymentId#_#=SalaryCodeId#") .Columns(columns => { columns.Bound(o => o.SalaryCodeId).Width(100); columns.Bound(o => o.UnitPrice).Width(100); columns.Bound(o => o.Hours).Width(100); columns.Bound(o => o.Days); columns.Bound(o => o.Amount).Width(100); }) .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(sat => sat.Id); }) .Read(read => read.Action("HierarchyBindingTransactions", "SalaryApproval", new { salaryApprovalGroupId = Model.Id, salaryApprovalEmploymentId = "#=SalaryApprovalEmploymentId#", salaryCodeId = "#=SalaryCodeId#" })) ) .ToClientTemplate() ) </script> <script> function dataBound() { var grid = this; this.tbody.find("tr.k-master-row").each(function( index ) { grid.expandRow(this); }); } </script>

Martin
Top achievements
Rank 1
Iron
 answered on 26 Nov 2021
1 answer
1.1K+ views
HI Using asp.net mvc .net (not core).  I want to disable columns for edit. Person can read it but cannot overrite it.  How I can do that?
Yanislav
Telerik team
 answered on 26 Nov 2021
1 answer
147 views
HI I am using asp.net mvc .net (not core). Creating the grid.  The grid has multiple columns I only want to have sorting in 2 columns.  HOw I can do that?
Yanislav
Telerik team
 answered on 26 Nov 2021
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?