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

Hi,

 

We are upgrading Telerik UI ASP.NET MVC from 2017.2.504.545 to 2022.1.301.545. We installed the latest DLL from MSI file and manually replaced the scripts and CSS files in the solution as well as referenced the 2022 Kendo.MVC.dll in the solution. Build success. When we try to access the page that use Teleric controls, I get the exception 'Grid' is ambiguous because multiple kinds of members with this name exist in class 'Kendo.Mvc.UI.Fluent.WidgetFactory' . If I change the dll version back to 2017, error is gone and page loads just fine. How can I resolve this? Is there anything missing in the upgrade steps I did?

Thanks,

A

Anitha
Top achievements
Rank 1
Iron
 asked on 18 Mar 2022
22 answers
1.1K+ views
Hi,

I've been using the Telerik Extensions for ASP.NET MVC for about 6 months now and I was excited to try the Kendo UI MVC Extensions. However, after trying it out for a few hours I do not think it is ready to be used for my new project, I'll stick to Telerik for a bit longer. Here are the bugs (I think they're bugs) I've found so far.

1) Localization. I was happy to see the text localize when I switch the page's CurrentCulture. Somehow, the grid is properly localized BEFORE the data loads but switches back to default (en-US) as soon as the binding finishes. Currencies are not localized either.

2) Aggregates. If the grid is empty, I get a Javascript Error: Uncaught ReferenceError: count is not defined and the default "No records to display" message is not displayed. This does not happen with Telerik MVC extensions.

3) Aggregates - date format. There's a problem with grouping and displaying dates (probably related to Json). Without grouping the dates are fine, but with grouping I get: /Date(1337704107810)/ . Once again this would not happen with Telerik.

4) Horizontal scrolling. I'm not sure if this is a bug or a bad setting, but when using horizontal scrolling with a grid that has groups and aggregate Sums and Counts in the main grid footer, the footer is static, it does not scroll with the rest of the grid. This works fine with Telerik. The detail footers scroll as expected though.

Let me know if you need further details to reproduce the issues.

Thanks,
Mathieu
Anitha
Top achievements
Rank 1
Iron
 updated answer on 18 Mar 2022
6 answers
645 views

Since you would have a start and end date, how do you set up the control for DateRangePickerFor to bind to 2 fields. 

I really like the 2 calendar view with the DateRange Picker but struggling on how to wire up the binding for the post back to the controller.

Thanks

Peter

Daniel
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 16 Mar 2022
2 answers
334 views

Hey guys,

I added a custom legends to my graph chart usining Legend. Item.Visual

now i want to add a link near of every legend that do something:

I tried to add labels.template with a simple string- just to check if it works before i change it to link, but it shows nothing,

I tried to googled it, but i didn't find any relevant information.

here is my chart and custom function for legens:

   

@(Html.Kendo().Chart()
   .Name("stacked-bars")

 .Legend(legend => { legend.Position(ChartLegendPosition.Left).Margin(m =>       m.Right(100)).Orientation(ChartLegendOrientation.Vertical).Item(i => i.Visual("createLegendItem"))

.Labels(l => l.Template("some text to check if works")); })

    .SeriesDefaults(seriesDefaults =>
        seriesDefaults.Column().Stack(true).Gap(10).Spacing(1.3)
    )
        .Series(series =>
        {
            series.Column(Model.Nidkha).Color("#E6BA55").Name("name1");
            series.Column(Model.Betipul).Color("#E655AE").Name("name2");

            series.Column(Model.TakinPaarKaspi).Color("#55BFE6").Name("name3");


        })

        .CategoryAxis(axis => axis
            .Categories(Model.Months.Select(m => m.ToString()).ToArray())
            .MajorGridLines(lines => lines.Visible(false))
        )
        .Panes(panes => panes.Add().Clip(false))
        .ValueAxis(axis => axis
            .Numeric()
            .Labels(labels => labels.Format("{0}").Position(ChartAxisLabelsPosition.End))
            .Line(line => line.Visible(false))
            .MajorGridLines(lines => lines.Visible(true))
        )
        .Tooltip(tooltip => tooltip
            .Visible(true)
            .Template("#= series.name #: #= value #")
        )
            )

<script>

        

function createLegendItem(e) {
        var color = e.options.markers.background;
        var labelColor = e.options.labels.color;

        var rect = new geometry.Rect([0, 0], [300,45]);
        var layout = new drawing.Layout(rect, {
            alignContent: "start",
            alignItems: "start",
            justifyContent: "end",
            lineSpacing: 40,
            orientation: "horizontal",
            prefix: "m-sd",
            revers: false,
            spacing: 2,
            wrap: false
        });

        var overlay = drawing.Path.fromRect(rect, {
            fill: {
                color: "#fff",
                opacity: 0
            },
            stroke: {
                color: "none"
            },
            cursor: "pointer"
        });

        var column = createColumn(new geometry.Rect([0, 0], [15, 10]), color);
        var label = new drawing.Text(e.series.name, [0, 0], {
            fill: {
                color: labelColor
            }
        })

        layout.append(label, column);
        layout.reflow();

        var group = new drawing.Group().append(layout, overlay);

        return group;
    }

 </script>

and this is my result:

any advice?

thanks in advance.


 

 

Ruth
Top achievements
Rank 1
Iron
Iron
 answered on 16 Mar 2022
1 answer
222 views

I have a grid that I would like to be groupable by several columns.

In the example below, it is Pattern and State.  Looking at the pattern for SMTWTFS you can see I have a button for both PA and SMTWTFS when I'd like to only have the button show for Pattern (SMTWTFS)

 

I think I only have the template on my Pattern column, so not sure why it is showing by state as well.  Is there any way I can stop it applying at the State group line too?  I've tried giving it its own group template, but with and without does not work.

 


    @(Html.Kendo().Grid<WM_SupplyChainPortal.Models.Schedule.Views.ChangeScheduleStorePattern>
    ()
    .Name("storepattern")
    .Columns(columns =>
    {
    columns.Bound(s => s.Store).Filterable(ftb => ftb.Multi(true)).Groupable(false);
    columns.Bound(s => s.StoreName).Filterable(ftb => ftb.Multi(false)).Groupable(false);
    columns.Bound(s => s.State).Filterable(ftb => ftb.Multi(true)).Groupable(true).ClientGroupFooterTemplate("");
    columns.Bound(s => s.Region).Filterable(ftb => ftb.Multi(true)).Groupable(true);
    columns.Bound(s => s.District).Filterable(ftb => ftb.Multi(true)).Groupable(true);
    columns.Bound(p => p.Pattern).Filterable(ftb => ftb.Multi(true)).ClientGroupFooterTemplate("#=value# <button class='myButton' onclick='confirmGroup(\"#=value#\")'>Edit</button>");
    })
    .Sortable()
    .PersistSelection()
    .Scrollable(s => s.Height("465px"))
    .Groupable()
    .Filterable()
    .HtmlAttributes(new { style = "height:600px;" })
    .Resizable(r => r.Columns(true))
    .Reorderable(reorder => reorder.Columns(true))
    .DataSource(dataSource => dataSource
    .Ajax()
    .Model(model => model.Id(p => p))
    .Read(read => read.Action("ChangeStorePatterns", "Schedule"))
    )
    )

Yanislav
Telerik team
 answered on 14 Mar 2022
1 answer
257 views

Hi,

I find myself in a position where I have multiple events happening at a single time/day in the Scheduler tool, and they're basically unreadable in the Week view (which is the preferred view for my target audience).  Each entry is just a sliver of color unless they go into Day view which is not a workable solution.

Screenshot is shown below.  I need my viewers to be able to see at a glance which events are happening at 9am - in this particular case, I don't care that they see it goes 9am-10am as it really just starts at 9am and runs until finished (usually a minute or two)

If it helps, all of the 8 events listed will have the same start and end time exactly (09:00-10:00).

 

The timeline week view works well, but the users will not want to scroll to see the whole week

 

Is there some css class I can overwrite, or some javascript I can put in place that will force them to stack like the timeline view, within the week view?

Ivan Danchev
Telerik team
 answered on 09 Mar 2022
0 answers
261 views

I waited for support and did not get a valid answer ... I need help as soon as possible please

I need these versions of the assemblies and when I try to browse the NuGet server in visual studio it find nothing .. and the Control Panel does not allow me to install previous versions and the versions shown are not availible for download 

There are multiple versions of files ... why would I use 2020.2.617  when the project and deployed versions are 2020.2.615.40 ?

Telerik.Web.Design, Version=2020.2.617.45

Telerik.Web.Spreadsheet, Version=2020.2.616.40

Telerik.Web.UI, Version=2020.2.617.45

Telerik.Web.UI.Skins, Version=2020.2.617.45

Telerik.Windows.Documents.Core, Version=2020.2.615.40

Telerik.Windows.Documents.Flow, Version=2020.2.615.40

Telerik.Windows.Documents.Spreadsheet, Version=2020.2.615.40

Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml, Version=2020.2.615.40

Telerik.Windows.Zip, Version=2020.2.615.40

Telerik.Reporting, Version=14.1.20.618

Telerik.ReportViewer.WebForms, Version=14.1.20.618

Stephen
Top achievements
Rank 1
Iron
 asked on 09 Mar 2022
0 answers
408 views

Hello,

I am working on Kendo Grid and wants to perform all operation server side.

For now, everything is working, except, when I call Read action and find the correct page number, and set it on the DataSourceResult, the object is found on the Grid, Selected and Highlighted as expected,
but the UI Pager value always shows 1/set to 1, no matter what Page value I have set in the DataSourceResult.

Below is my cshtml code:

@(Html.Kendo().Grid<dynamic>()
      .Name($"Grid_{Model.Name}")
      .Columns("Some Columns")
      .Pageable(Model.Pager)
      .Filterable(ftb => ftb
         .Mode(GridFilterMode.Row)
      )
      .DataSource(dataSource => dataSource
         .Ajax()
         .Read(read => read.Action("GetBrowseResults", Model.Controller, new { area = string.Format("Module/{0}", Model.Controller), theTypeToBrowse = Model.TypeToBrowse, theGroupObj = Model.IsGroupType }))
         .PageSize(Model.IsTouchDevice ? 20 : 100)
      .ServerOperation(true)
      )
      .Events(events => events.Change("LibraryRecordSelected").DataBound("LibraryDataBound"))
)

 

And here is the C# code:

public ActionResult GetBrowseResults([DataSourceRequest] DataSourceRequest theRequest, string theTypeToBrowse, string theGroupId, bool theGroupObj)
      {
         var browseResult = GetBrowseResults(theTypeToBrowse, theGroupId, theGroupObj);

         if (browseResult != null)
         {
            var ret = FilterBrowseModel(browseResult, theRequest);
            var result = Json(ret.Item1.ToDataSourceResult(ret.Item2));
            result.MaxJsonLength = int.MaxValue;
            return result;
         }
      }
          
public (List<BrowseModel>, DataSourceRequest) FilterBrowseModel(IEnumerable<BrowseModel> theBrowseModel, DataSourceRequest theDataSourceRequest)
      {
         var ret = new List<BrowseModel>();
         int total = theBrowseModel?.Count() ?? 0;

         if (total > 0)
         {
            bool reset = true;

            if (theDataSourceRequest.Page > 0 && theDataSourceRequest.PageSize > 0)
            {
                  var objectData = GetObjectData(HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString());
                  if (objectData?.ObjectTxt != null)
                     theDataSourceRequest.Page = (theBrowseModel.ToList().FindIndex(x => x.ObjectTxt == objectData.ObjectTxt)) / theDataSourceRequest.PageSize + 1;
            }

            if (reset)
               ret.AddRange(theBrowseModel);
         }

         return (ret, theDataSourceRequest);
      }


Ammad
Top achievements
Rank 1
 asked on 07 Mar 2022
1 answer
405 views

I need to be able to add a form button in the content using the editor. Using the "view html" tool, I am able to create a button. However, I need this button to have an "onclick" property. This was possible in pervious rad editor. Is this a possibility in the current editor? 

Currently, that "onclick" property value gets stripped out when pressing "update". 

<inupt type="button" onclick="myfunction()" value="here" /> 


Aleksandar
Telerik team
 answered on 03 Mar 2022
1 answer
269 views

Hey guys,

I got the problem that "ContentHtmlAttributes" are not applied when loading with "LoadContentFrom".

Same problem as in this thread, but that one is old and was posted in community forum. 

 

My TabStrip:

@(Html.Kendo().TabStrip()
	  .Name("tabStripNav")
	  .Items(x =>
	  {
		  x.Add()
		   .Text("Header 1")
		   .ContentHtmlAttributes(new { style = "background-color: red !important;" })
		   .LoadContentFrom("Action1", "Controller", new{itemId = Model.Id});
		  x.Add()
		   .Text("Header 2")
		   .LoadContentFrom("Action2", "Controller", new{itemId = Model.Id});
		  x.Add()
		   .Text("Header 3")
		   .LoadContentFrom("Action3", "Controller", new{itemId = Model.Id});
	  })
	)

Am I doing anything wrong here?

Best regards

Nils

Eyup
Telerik team
 answered on 03 Mar 2022
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?