Telerik Forums
UI for ASP.NET MVC Forum
16 answers
1.7K+ views
We have the below action in a controller for Kendo grid data population

1.public ActionResult GetCompanyDetails([DataSourceRequest] DataSourceRequest request)
2.{
3.    var companyDetails = BusinessLayer.GetCompaniesDetail();
4.    return Json(companyDetails.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
5.}

While running checkmarx scan the above method was identified for Reflected XSS vulnerability.

Method GetCompanyDetails at line 1 of wxy/xyz/Controllers/ABCController.cs gets user input for the request element. This element’s value then flows through the code without being properly sanitized or validated and is eventually displayed to the user in method GetCompanyDetails at line 4 of wxy/xyz/Controllers/ABCController.cs. This may enable a Cross-Site-Scripting attack.

How to sanitize the DataSourceRequest request object to fix this XSS issue?
Jack
Top achievements
Rank 1
Iron
Iron
 answered on 16 Jun 2022
1 answer
129 views

Hi,

we recently updated out project from Telerik 2019 to Telerik 2022.

Now our grids behave differently (without error) when we use getOptions() and setOptions() to keep the grids state; the column headers seem to change.

 

Here is a column header before we restore the state:

<th class="k-header" data-field="Prioritaet" data-index="6" data-title="Priorität" id="03b46289-2aba-487e-ba2e-e4aa67dae464" scope="col" data-role="columnsorter"><a class="k-link" href="/inoTerminal/Fremdpanzer/Read?fremdpanzerTable-sort=Prioritaet-asc">Priorität</a></th>

Here is a the same column header after we restore the state:

<th scope="col" role="columnheader" data-field="Prioritaet" rowspan="1" data-title="Priorität" data-index="6" headers="undefined" id="03b46289-2aba-487e-ba2e-e4aa67dae464" class="k-header" data-role="columnsorter"><span class="k-cell-inner"><span class="k-link"><span class="k-column-title">Priorität</span></span></span></th>

 

Visibly this produces these results:

Before: 

After: 

Otherwise the functionality seems to be the same.

 

We're using the MVC-Helpers to generate the grid...

 

Update: 

To clarify, the difference in visible style comes through the css we implemented for the headers:

.k-grid-header th.k-header > .k-link {
    font-weight: bold;
    color: #2fa4e7;
    height: auto;
}

After restoring the grid state the hierarchy of elements in the headers has changed. And because we use the direct child selector (>), the styles are not applied anymore. We solved this now by omitting the direct child selector.

 

So the issue is not a severe one, but I'm still curious if it is expected behaviour, that the header markup changes after getOptions/setOptions?

Yanislav
Telerik team
 answered on 16 Jun 2022
0 answers
102 views

I have an existing grid which works fine.

Now I need to introduce a dropdown in toolbar for filtering in a column.
The column in question already has filtering implemented. However the client requires a dropdown in toolbar for ease of use as there are many columns and have scroll horizontally each time.

In short this dropdown has to do exactly what a column filter does, but it should be placed in toolbar along with search bar.

Is this possible? how to implement it?

Azhar
Top achievements
Rank 1
Iron
 asked on 16 Jun 2022
0 answers
155 views

How do I get the encrypted credentials for my account?

And how do I make it work?
Previously one guy tried to do it and failed, so now I'm going in for a new attempt. Clean slate.

This is what the config looks like right now (without username and password) :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
  <packageSources>
    <add key="nuget.telerik.com" value="https://nuget.telerik.com/v3/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <nuget.telerik.com>
      <add key="Username" value="myemail" />
      <add key="ClearTextPassword" value="mypassword" />
    </nuget.telerik.com>
  </packageSourceCredentials>
</configuration>
Martin
Top achievements
Rank 1
Iron
 asked on 13 Jun 2022
1 answer
140 views

I have a number of grids that use the Endless scroll with the scrollable height set to 500 (see helper code below) with a default page size of 10.  Sometimes the vertical scollbar doesn't appear on the grid even though it indicates that there are more records then are being shown (pages).  

If i set the height to something else, for instance 472 it seems to show the scroll bar, but i am worried this is driven by the size of the rows and won't be durable.

 


        public static GridBuilder<T> EndlessScrollDefault<T>(this GridBuilder<T> gridBuilder, string emptyMsg = "There are no records to show.", int? height = 500) where T : class
        {
            var rVal = gridBuilder.Pageable(page =>
            {
                page.Enabled(true);
                page.PageSizes(false);
                page.Input(false);
                page.Numeric(false);
                page.PreviousNext(false);
                page.Refresh(true);
                page.Messages(message => message.Empty(emptyMsg));
            })
                .Scrollable(s => s.Endless(true));
            if (height != null)
            {
                rVal = rVal.Scrollable(s => s.Height(height.Value));
            }
            return rVal;
        }

Eyup
Telerik team
 answered on 13 Jun 2022
1 answer
119 views

how to set NumericTextBox format dynamically like below. I tried this but its not working.


var dynamicValue = "###,###.000";

@(Html.Kendo().NumericTextBox<double>()
	.Name("Amount")
	.Spinners(false).Format("dynamicValue")
	.Decimals(3)
	.HtmlAttributes(new { style = "width: 100%; height: 27px;", tabindex = "6" })
	.Events(e => e.Change("OnAmountChange"))
)

dynamicValue is set as the response of GET API call.

Anton Mironov
Telerik team
 answered on 09 Jun 2022
1 answer
191 views
Doesn't look like Exportable is available in GridColumnSettings. I'm using the LoadSettings feature on a Grid and I want to set some columns to not be exported to Excel. Exportable is a setting when using the column binding but I don't see it in the GridColumnSettings class.
Yanislav
Telerik team
 answered on 08 Jun 2022
0 answers
108 views

I have a problem with kendo DateTimePicker when setting component type to modern. The control has a weird behavior and does not have an exact pattern to reproduce the problem, only that sometimes when making the transition from the date view to the time view or vice versa, the time view gets stuck and loses buttons.

You could replicate the issue on the telerik demo page, https://demos.telerik.com/aspnet-mvc/datetimepicker/component-type

Kendo version: 2022.2.510
Jquery version: 3.6.0

Please advise.
Thank you.
Joseph
Top achievements
Rank 1
 asked on 06 Jun 2022
1 answer
160 views

I am trying to customize the Marker of a ScatterLine chart. If the data is of type A then show ChartMarkerShape.Triangle otherwise show ChartMarkerShape.Circle? 

This is my current code 

                        

@(Html.Kendo().Chart(Model.DosageUnitsOfInsulin)
                        .Name("DosageTotal")
                        .Title("Total Series")
                        .Series(series => {

                            series.ScatterLine(model => model.DosageDate, model => model.DosageTotal).Width(4).ColorHandler("getColor");
                        })
                        .SeriesDefaults(seriesDefaults => seriesDefaults
                            .ScatterLine().Markers(markers => markers.Size(20).Type(ChartMarkerShape.Circle)).Color("#47AADF")
                        )

                        .XAxis(x => x
                            .Date()
                            .BaseUnit(ChartAxisBaseUnit.Days)
                            .Title(title => title.Text(""))
                            .Labels(m => m.DateFormats(v => v.Days("M/d/yyyy") ))
                            .Min(new DateTime(2021,2,7))
                            .Max(new DateTime(2021, 9, 28))
                            .MinorGridLines(m => m.Visible(true))
                            .MajorGridLines(m => m.Visible(true))
                        )
                        .YAxis(y => y
                            .Numeric()
                            .Title(title => title.Text("Units of Insulin"))
                            .Min(65)
                            .Max(110)
                            .AxisCrossingValue(-5)

                        )
                        .Theme("sass").Legend(leg => {
                            leg.Position(ChartLegendPosition.Bottom);
                        })
                        .Tooltip(tooltip => tooltip
                            .Format("{0:d}, {1}")
                            .Visible(true)
                        )
                        .Events(events => events.Render("onRender"))
                        .Zoomable()
                        .Pannable()
                    )

 

Is it possible to dynamically change the marker when the chart is rendered? I have subscribed to the Visual event like the Custom Visual example. However, I just want the standard Telerik circle and sometimes triangle visual not a custom image.

 

Thanks,

 

Tim

 

Anton Mironov
Telerik team
 answered on 06 Jun 2022
0 answers
113 views

Hello,

We have a specific scenario reported from our client with the "Clean Formatting" tool in the editor button.

Copy the Strikethrough text from MS word & paste it in Editor.

Expectation here is clean formatting tool should remove the Strikethrough & text should become normal. It works fine when we copy the text from "Google Doc".

I know that "clean formatting" tool removes all the styles associated.

When the text is copied from "Google Doc", it will have the "Span" element with the css associated. hence the clean formatting option will be able to remove the css & make it as normal text.

Strikethrough

When the text is copied from "MS Word", it will have the "<s>" element without any css associated. hence the clean formatting option will NOT be able to make the text normal since there are no associated css.

Strikethrough

Please let me know if you have any idea to achieve this functionality ?

Thanks & Regards, Puru

Purushothama
Top achievements
Rank 1
 asked on 03 Jun 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?