Telerik Forums
UI for ASP.NET MVC Forum
1 answer
99 views
    
Eyup
Telerik team
 answered on 12 Apr 2021
2 answers
145 views

I am using a DatePicker in a Modal to change the dates of various records without reloading the whole page. The Modal is loaded via an Ajax call. The modal contains a form and a single field similar to:

 

@(Html.Kendo().DatePickerFor(x => x.ScheduledDate)
                    .Start(CalendarView.Year)
                    .Depth(CalendarView.Month))
                )

 

This works fine the first time the modal loads but on subsequent calls, the date picker is not rendered and an unstyled textbox is shown instead.

I am guessing that this has something to do with the fact that the page has already handled a control with the same id but because the modal has been replaced with new html, there are no duplicate ids on the page and I want to force kendo to render the picker again on the new control.

 

How do I do this?

Paul
Top achievements
Rank 1
 answered on 09 Apr 2021
5 answers
712 views

I've got a Kendo editor with custom CSS styles that I'm importing via a custom style sheet. Is there a way to apply the classes to the p element instead of wrapping the text with a span element. I'm trying to control how the user formats the text to just the classes in my style sheet.

Thanks.

@(Html.Kendo().EditorFor(model => model.HtmlContent)
                               .HtmlAttributes(new { style = "width: 85%;height:600px;" })
                               .Encode(false)
                               .Tools(tools => tools
                                   .Clear()
                                   .Bold().Italic().Underline().Strikethrough()
                                   .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull()
                                   .InsertUnorderedList().InsertOrderedList()
                                   .Outdent().Indent()
                                   .CreateLink().Unlink()
                                   .InsertImage()
                                   .InsertFile()
                                   //.SubScript()
                                   //.SuperScript()
                                   .TableEditing()
                                   .ViewHtml()
                                   .CleanFormatting()
                                   //.FontName()
                                   //.FontSize()
                                   //.FontColor().BackColor()
                                   .Formatting(formatting => formatting
                                     .Add("Intro Paragraph", ".doc-intro-paragraph")
                                     .Add("FAQ Question", ".doc-question")
                                     .Add("FAQ Answer", ".doc-answer")
                                     .Add("Section Title", ".doc-section-title")
                                 )
                               )
                               .PasteCleanup(p => p
                                   .All(false)
                                   .Css(true)
                                   .KeepNewLines(false)
                                   .MsAllFormatting(true)
                                   .MsConvertLists(true)
                                   .MsTags(true)
                                   .None(false)
                                   .Span(true)
                               )
                               .StyleSheets(css => css.Add(Url.Content("~/Content/TextEditor.css")))
 
                               .ImageBrowser(imageBrowser => imageBrowser
                               .Image("~/Content/Images/{0}")
                               .Read("Read", "ImageBrowser")
                               .Create("Create", "ImageBrowser")
                               .Destroy("Destroy", "ImageBrowser")
                               .Upload("Upload", "ImageBrowser")
                               .Thumbnail("Thumbnail", "ImageBrowser")
                               )
 
                               .FileBrowser(fileBrowser => fileBrowser
                               .File("~/Content/Documents/{0}")
                               .Read("Read", "FileBrowser")
                               .Create("Create", "FileBrowser")
                               .Destroy("Destroy", "FileBrowser")
                               .Upload("Upload", "FileBrowser")
                               )
                           )

 

 

Alex
Top achievements
Rank 1
Iron
 answered on 09 Apr 2021
3 answers
427 views

Hello,

In our MVC project we used two kendo dropdownlist widgets. Since data may become huge we implemented virtual.valueMapper() to get job done. Both dropdownlist worked as expected but when I debug code and found one of valueMapper() never be called. Those two dropdownlist had exactly same setting. Why they are function differently? I am so curious the reason. Could someone explain this? Below are the code. Thanks in advance.

    <div class="col-lg-3 col-md-3 col-sm-3">
        @(Html.Kendo().DropDownListFor(model => model.FIELD1)
                                                .DataTextField("Display")
                                                  .DataValueField("Value")
                                                  .Filter("contains")
                                                  .DataSource(source =>
                                                  {
                                                      source.Custom()
                                                          .ServerFiltering(true)
                                                          .ServerPaging(true)
                                                          .PageSize(80)
                                                          .Type("aspnetmvc-ajax")
                                                          .Transport(transport =>
                                                          {
                                                              transport.Read("GetField1Data", "Editor");
                                                          })
                                                          .Schema(schema => schema.Data("Data").Total("Total"))
                                                          ;
                                                  })                                       
                                                 .Virtual(v => v.ItemHeight(26).ValueMapper("valueMapperField1"))//<- never be called 
                                                   
            )
    </div>
    <div class="col-lg-3 col-md-3 col-sm-3">
        @(Html.Kendo().DropDownListFor(model => model.FIELD2)
                                                  .DataTextField("Display")
                                                  .DataValueField("Value")
                                                  .Filter("contains")
                                                  .DataSource(source =>
                                                  {
                                                      source.Custom()
                                                          .ServerFiltering(true)
                                                          .ServerPaging(true)
                                                          .PageSize(80)
                                                          .Type("aspnetmvc-ajax")
                                                          .Transport(transport =>
                                                          {
                                                              transport.Read("GetField2Data", "Editor");
                                                          })
                                                          .Schema(schema => schema.Data("Data").Total("Total"))
                                                          ;
                                                  })                                           
                                                 .Virtual(v => v.ItemHeight(26).ValueMapper("valueMapperField2")) //<- call valueMapperField2 function correctly.                                              
            )

    </div>

Ivan Danchev
Telerik team
 answered on 08 Apr 2021
6 answers
1.3K+ views

I'm having an issue that I need help with.

First, I'll explain what I need to do. I need to set three properties on a Grid

    1.- The "pageSizes" (the options on the "items per page" dropdown).

    2. The "pageSize" (default page size for the grid).

    3.- The "height".

I'm doing this using the "setOptions" method, like this:

        grid.autoBind = false;
        grid.setOptions({
            groupable: true
            , pageable: {
                pageSizes: selPageSizes,
                pageSize: selDefaultPageSize
            }
            , dataSource: { pageSize: selDefaultPageSize }
            , height: selGridHeight
        });       

This is working fine, but I'm getting an error. The grid is refreshed after calling the .setOptions method (I understand that it is the expected behavior) and I get the "Cannot read property 'removeClass' of null" (screenshot attached, along with the screenshot of the code that is triggering this error).

I tried setting the "autoBind" property to "false" before calling the .setOptions method, but I'm still getting the error.

I've checked on the forum, and I found the following post:

   https://www.telerik.com/forums/i-m-sometimes-getting-this-error-ucaught-typeerror-cannot-read-property-%27removeclass%27-of-undefined

I tried what was suggested there, but some things won't apply, and the others won't work (BTW, the first link is broken, which was the most promising one).

So, is there a way that I can prevent the grid to refresh after calling .setOptions? Or there's something that I can do to avoid the error, if the grid is refreshed?

Or is there any other way to set the three properties that I mentioned at the beginning of the post?

 

Georgi Denchev
Telerik team
 answered on 07 Apr 2021
1 answer
561 views

I have a requirement that on a page that already contains a number of widgets to display a window that contains the same widgets.

The problem is that the page and the partial view loaded in the window are created using

@Html.Kendo().XXXFor(m => m.Property)....

and have discovered that when I load the window the widget on the page disappear and the widget on the window is not created. Also there are a lot of errors in the kendo code.

Is there a way to change the name that is required by the telerik but to leave the input names as they are?

Neli
Telerik team
 answered on 07 Apr 2021
1 answer
113 views

Hi everyone,

I have created a view page that displays four charts, now I want to PDF each of these charts on one page so four pages total.

So far I can export all four charts on a single page.

is there any way to achieve this, is it possible.

thanks

Ray

Nikolay
Telerik team
 answered on 07 Apr 2021
6 answers
1.2K+ views
Hi,
I have a problem with the management of seconds with datetime picker with the "modern" type component: they are not displayed on popup (use of "G" format). Worse, the seconds are initialized with the current seconds (and not 0).
I can understand that there is a problem with the management of AM / PM hours, but that is not my case (24H display)
Is there a solution? apart from going back to "classic" mode, because for touch, the new version is more practical, and without using keyboard input (touchscreen mode)

On the other hand, is there a solution to use this component on a smartphone in landscape mode? (today, the popup is too high and goes out of the screen, or doesn't appear). I tried to put the tabs on the left and the buttons on the right via CSS but without success …

Regards
P.S. : I use kendo ASP.NET MVC 2021.1.224
Anton Mironov
Telerik team
 answered on 06 Apr 2021
5 answers
1.0K+ views

Hi All,

Just wondering where to find sample to invoke item command for checked item on my kendo grid using my custom button?

Also how to show that row is selected when I check the checkbox?

Lastly how to unchecked my header template checkbox when I change page?

columns.Bound(column => column.ProfileID)
.ClientTemplate("<input class='box' type='checkbox' value='#=ProfileID#' />")
.ClientHeaderTemplate("<input type='checkbox' id='selectAll' onclick='toggleSelection()' />")
.Width(40)
.Sortable(false)
.Filterable(false);

Thanks in Advance

Ryan

Mihaela
Telerik team
 answered on 05 Apr 2021
1 answer
126 views
"grid.options.pageable" never contains all values. In my case, I am looking for the values of "numeric" and "previousNext".
Mihaela
Telerik team
 answered on 05 Apr 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?