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

I have a grid filter on a column that doesn't allow decimals.  I tried the solution provided in this forum topic but it appears to only work when Mode(GridFilterMode.Row) is set but I have to use Mode(GridFilterMode.Menu).  Do you have a working example for the Mode(GridFilterMode.Menu) option to ensure that decimals don't show up in the input after you filter the grid and reopen the filter input menu or focus out of the filter input for the numeric text box?

code for the column in the grid:

columns.Bound(c => c.ProspectID).Title("ID").Sortable(true).Filterable(ftb => ftb.Cell(cell => cell.Template("customFilter"))).Format("{0:N0}");

 

Custom form to export the excel from a grid external html button:

<form class="grid-export" action="@Url.Action("CreateExcelFile")" method="POST">
     <input type="hidden" id="export-grid" name="grid" value="" />
     <input type="hidden" id="export-model" name="model" value="" />
     <input type="hidden" id="export-title" name="title" value="Prospects Export" />
     <input type="hidden" id="export-format" name="format" value="xlsx" />
     <input type="hidden" id="export-criteria" name="criteria" value="" />
     <button id="btnGridExport" type="submit" class="submitButtons secondary" onclick="exportExcel()">Export</button>
</form>

JavaScript code to align to that so far:

function exportExcel() {
    var grid = $("#prospectGrid").data("kendoGrid");
    $("#export-model").val(encodeURIComponent(JSON.stringify(grid.columns)));
    $("#export-grid").val("prospectGrid");
    closeGridExport();
}

function customFilter(args) {
    args.element.kendoNumericTextBox({
        decimals: 0,
        format: "n0"
    });
}

Thanks,

Sean

Sean
Top achievements
Rank 1
Iron
 updated question on 11 May 2022
8 answers
1.4K+ views

I want to have the grid number column (ID field) filter to be integer.  How can I accomplish that?  When it run, the filter show decimal.  There is no JavaScript for it.  What is the correct code?

Thank you very much in advance!!
Anieda

Here is the code:

@{<br>    Html.Kendo().Grid(Model)<br>        .Name("grid")<br>        .Columns(columns =><br>        {<br>     columns.Bound(request => request.Id).Encoded(false);<br>     columns.Bound(request => request.Requestor).Encoded(false);<br>     columns.Bound(request => request.RequestDate).Format("{0:MM/dd/yyyy}").Encoded(false);<br>     columns.Bound(request => request.ChangeStartDateTime).Format("{0: M/d/yyyy h:mm tt}").Encoded(false);<br>     columns.Bound(request => request.ChangeEndDateTime).Format("{0: M/d/yyyy h:mm tt}").Encoded(false);<br>     columns.Bound(request => request.RequestSubject).Encoded(false);<br>     columns.Bound(request => request.CurrentStatus).Encoded(false);<br>     columns.Bound(request => request.CompletedFlag).Encoded(false);<br> })<br>.Filterable(filterable => filterable<br>   .Extra(false)<br>   .Operators(operators => operators<br>       .ForString(str => str.Clear()<br>           .Contains("Contains")<br>           .StartsWith("Starts With "))<br>       .ForNumber(num => num.Clear()<br>              .IsEqualTo("Equal to"))<br>       .ForDate(d => d.Clear())<br>    )<br>   .Mode(GridFilterMode.Row))<br>.Pageable(pageable => pageable<br>   .Refresh(true)<br>   .PageSizes(true)<br>   .ButtonCount(5))<br>.Resizable(resize => resize.Columns(true))<br>.Selectable()<br>.Sortable()<br>.DataSource(dataSource => dataSource<br>.Server()<br>.Model(model => model.Id(request => request.Id))<br>)<br>.ToolBar(toolbar =><br>{<br>   toolbar.Template(@<text><br>    <div class="toolbar"><br>        <label class="category-label" for="category">Requests</label><br>        @Html.ActionLink("New Request", "New", "Request", null, new { @class = "btn-primary btn" })<br>    </div><br></text>);<br>})<br>.Render();
Sean
Top achievements
Rank 1
Iron
 answered on 09 May 2022
1 answer
475 views

Scenario: Drop-down for customer to select preferred language. If they choose anything other than English, the Radio Group 'Interpreter Required?' (Yes / No) would be a required field. If they select English, this Radio Group is NOT required.

I have the 'Required' Data Annotations set in my model:

[Required]
public int? LanguageID { get; set; }

[Required]
public int? InterpreterRequiredID { get; set; }


View:

<div class="form-group">
    <label>What is your preferred language?</label><br />

    @Html.Kendo().ComboBoxFor(m => m.LanguageID).BindTo(new List<SelectListItem>()
    {
        new SelectListItem() { Text="English", Value="E" },
        new SelectListItem() { Text="Spanish", Value="S" },
        new SelectListItem() { Text="Other", Value="O" }
    }).Events(e => e
        .Change("LanguageID_onChange")
    )
</div>
<div class="form-group">
    <label>Do you require an interpreter?</label><br />
    @Html.Kendo().RadioGroupFor(m => m.InterpreterRequiredID).Items(i =>
        {
            i.Add().Label("Yes").Value("1");
            i.Add().Label("No").Value("2");
        })
</div>
<script>
    function LanguageID_onChange(e) {
        var el = document.getElementById('InterpreterRequiredID');

        if (this.value() == 'E') {
            el.removeAttribute("data-val-required");
        } else {
            el.setAttribute("data-val-required", "This is required!");
        }
    }
</script>
The Radio Group is still requiring a selection upon submission, no matter the language selected. If I change the target control in the javascript function to any other type of input (such as textbox or combobox), the required attribute is successfully removed / assigned according to the language selection. It just doesn't appear to work with the RadioGroup.
Anton Mironov
Telerik team
 answered on 09 May 2022
1 answer
146 views

I really have two questions: The first is as described above. I really have no need for the tool bar other than for entering cell comments, so I would like to know if there is a way to invoke that functionality with a double click. Also, I am replacing a Windows Desktop Application that does allow the users to double click to add comments so if I cannot do this in Kendo UI, it will be a behavior change for the users.

Secondly, can comment data be bound to the data source so that when I do a load or submit the database Comment field is updated along with all the other data?

Anton Mironov
Telerik team
 answered on 29 Apr 2022
1 answer
274 views

Hi,

So basically I'm trying to load the items of my PanelBar at the creation of the PanelBar. My item has a LoadContentFrom itself but it only triggers once I open the panelbar item. It used to work with the LoadOnDemand property set to false but it doesn't anymore. Any idea what is I am doing wrong here?

@(Html.Kendo().PanelBar()
            .Name("panelbar")
            .ExpandMode(PanelBarExpandMode.Multiple)
            .HtmlAttributes(new { @class = "k-primary", type = "submit", style = "width:100%" })
            .LoadOnDemand(false)
            .Items(panelbar =>
            {
                panelbar.Add().Text("Item Title").LoadContentFrom(Url.Action("Function", "Controller", Model));
            }))

 

Thanks again!

Yanislav
Telerik team
 answered on 29 Apr 2022
1 answer
220 views

I have a grid with a toolbar

    .ToolBar(
        tools =>
        {
            tools.Excel();
            tools.Custom().Text("Finalize").IconClass("k-i-success").HtmlAttributes(new { id = "customButton", @class = "floatRight" });
        }
    )

The icon class is k-i-success (also tried k-i-check-outline)

On this page (https://docs.telerik.com/kendo-ui/styles-and-layout/icons-web) it shows k-i-success as a checkmark in a circle.

But in my toolbar, it is a mail icon

 

Am I doing something wrong, or is there an error in the class name?

Kevin
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 28 Apr 2022
1 answer
149 views
Can the date labels in scheduler be customized to display arbitrary labels instead of dates? Instead of seeing Mon 1/1 Tue 1/2 can I show Item 1 Item 2 ... ?
Anton Mironov
Telerik team
 answered on 28 Apr 2022
1 answer
128 views

In some odd user-cases it is handy not to show the selected range inside the calendar when it shows up.

Case: Lets say you have a range already selected. Then you click the current start-date in the calendar which pops up. Further you click a new date back in time. This sets a new start date instead of selecting the end-date. The combination of actions requires 3 clicks to set the new range.

If the user unfortunately clicks on the start-date, it's not obvious to some people that the next date you select is still a start-date, unless you are aware that the controller does not select ranges backward in the calendar.

 

Yanislav
Telerik team
 answered on 28 Apr 2022
0 answers
116 views

I am using Web API Restful Services hosting on IIS, following are my Mvc controler code, I am new to telerik and it first time.

 public ActionResult Listtelerikgrid([DataSourceRequest(Prefix = "Grid")] DataSourceRequest request) {
            try
            {
                ServiceRepository serviceObj = new ServiceRepository();
                HttpResponseMessage response = serviceObj.GetResponse("/api/BreakUpValue/GetAllBreakUpValueDeals");
                response.EnsureSuccessStatusCode();
                IEnumerable<Models.RPS_BreakUpValue> RPSEquity = response.Content.ReadAsAsync<IEnumerable<Models.RPS_BreakUpValue>>().Result;

                 return Json(RPSEquity.ToDataSourceResult(request),  JsonRequestBehavior.AllowGet ); //View(RPSEquity);

            }
            catch (Exception)
            {
                throw;
            }
        }

    ============================================================================================

@using Kendo.Mvc.UI
@model IEnumerable<WebRPSUIFront.Models.RPS_BreakUpValue>
<div class="row">
    <div class="col-12">
        @(Html.Kendo().Grid<WebRPSUIFront.Models.RPS_BreakUpValue>()
            .Name("Grid")
            .AutoBind(true)
            .Columns(columns =>
            {
                columns.Bound(p => p.Sno);
                columns.Bound(p => p.Symbol);
                columns.Bound(p => p.BreakUpValue);
            })
            .Sortable()
            .Pageable()
            .Filterable()
            .HtmlAttributes(new { style = "height:550px;" })
            .DataSource(dataSource => dataSource
           // .WebApi()
           .Ajax()
            .Model(model =>
            {
                model.Id(p => p.Sno);
            })
                .Events(events => events.Error("error_handler"))  
                .Read(read => read.Action("Listtelerikgrid", "BreakUpValue"))
            )
        )
    </div>
</div>
<script type="text/javascript">
    function errorHandler(e) {
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            alert(message);
        }
    }
        function error_handler(e) {
    var errors = $.parseJSON(e.xhr.responseText);
    if (errors) {
            alert("Errors:\n" + errors.join("\n"));
        }
    }

</script>

 

Ali
Top achievements
Rank 1
 asked on 23 Apr 2022
0 answers
125 views

I just upgraded to version 2022.1412 from 2020.3.915.  I have a tooltip that loads dynamic content.  It used to show a loading panel to the user while it was reaching out the server.  After I upgraded it doesn't show it anymore and sometimes it seems like it's not doing anything because the load can take a few seconds.  Is there anyway to get this back?

This is what it used to look like...

 

 

Thanks

Dave Wolf
Top achievements
Rank 1
Iron
 asked on 22 Apr 2022
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?