Telerik Forums
UI for ASP.NET MVC Forum
1 answer
219 views
Is there a captcha component for MVC 5? I searched the list of components on the telerik site but did not see any reference to one.  If there is one, then can someone please provide a link to a video (i.e. maybe YouTube or Telerik site) showing how to use it in an MVC app?  Thanks in advance.
Vessy
Telerik team
 answered on 24 Oct 2018
3 answers
1.5K+ views

Hi

Is there any way to change the background color of all Mondays of the calendar of a MVC datepicker?

Georgi
Telerik team
 answered on 23 Oct 2018
1 answer
486 views
im trying out Telerik and the application I am working on requires me to have a different create and edit screen. In Mvc you of course had your create and edit page and you could edit those how you like. In Telerik you don't get those, but I was made aware you could create your own edit profile
I then proceeded to do that with the following code
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("editClient"))
Good news is that you get a different page for the edit, and the bad news is that, this is also now the create page. I'm grateful for assistance in getting this done.
Georgi
Telerik team
 answered on 22 Oct 2018
1 answer
557 views

Greetings,

I created my database and in my table exist a column with is auto incremented. However, I can't get to set the ID as hidden as I would normally do in MVC , namely the following.

@Html.HiddenFor(model => model.id)

 

Is there a way to accommplish this in telerik?

 

Nencho
Telerik team
 answered on 19 Oct 2018
5 answers
1.6K+ views

I am using the kendo.ui.MultiSelectwidget in a form with an Ajax.BeginForm wrapper.

The view model:

public class ContextViewModel
{
        public int Context_PK { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public List<int> OwnerPermissions { get; set; }
        public List<int> UserPermissions { get; set; }
 
}

 

Razor View Htmlhelper call:

@(Html.Kendo().MultiSelectFor(m => m.OwnerPermissions)
.DataTextField("Text")
.DataValueField("Value")
.DataSource(source =>
 {
      source.Read(read =>
      {
          read.Action("GetAppUsers", "Context");
      });
 })

 

AJAX binding action method:

[AllowAnonymous]
public JsonResult GetAppUsers()
{
     int applicationid = GetThisApplicationID();
 
     if (applicationid < 1) throw new Exception("Unable to determine application id");
     var adul = GetAllApplicationUsers(applicationid);
 
     var list = adul.Where(a => a.IsValidBadge)
       .Select(u => new
       {
         Text = (!String.IsNullOrEmpty(u.AltDisplayName) ? u.AltDisplayName : u.DisplayName)
                   + " (" + u.UsernameShort + ")",
         Value = u.AirportPersonID
       }).ToList();
 
     list.Insert(0, new  { Text = "Owner Not Set", Value = 0 });
 
     return Json(list, JsonRequestBehavior.AllowGet);
}

 

  •  Target Framework:  4.6.1
  •  ASP.NET MVC: 5.2.6
  •  Microsoft.AspNet.Razor: 3.2.6
  • Microsoft Visual Studio Enterprise 2017 15.8.7

debugging in chrome (Version 69.0.3497.100) but behavior is identical in Edge (Microsoft Edge 42.17134.1.0)

JQuery 1.12.4 (Attempts made with both Kendo included jquery.min.js and full nuget package for jquery)

Issue that is occurring is the deselect operation in the multiselect widget is not removing the entry, either programmatically or through a user event (selecting the 'X') from the model it is bound to. View is generated with view model OwnerPermissions property with one entry.

  1. When entry is removed and submitted to the forms POST action the view model OwnerPermissions property has the original value.
  2. When entry is removed and an entry added and submitted to the forms POST action the view model OwnerPermissions property contains original initial value along with new value.
  3. When an entry is added to the mutliselect and then the original entry is deleted, same as #3 results, submitted to the forms POST action the view model OwnerPermissions property contains original initial value along with new value.

If an attempt is made to programmatically remove the entry in javascript using the Deselect Event, by calling <kendo.ui.MultiSelect>.value() method with an empty array [] a javascript exception is throw (see below) when the <kendo.ui.MultiSelect>.trigger("change") is called.

function onDeselectOwnerPermissions(e) {
   var owmerMS =  $('#frm-context #OwnerPermissions').data("kendoMultiSelect");
   if(!owmerMS) {return;}
    var dataItem = e.dataItem;
 
    if(dataItem.Value && dataItem.Value > 0) {
         var selectapid = dataItem.Value;
         var selected = owmerMS.value();
 
          selected = jQuery.grep(selected, function(value) {
              return value != selectapid;
          });
          owmerMS.value(selected);
          owmerMS.trigger("change");
    }
 }

 

Exception thrown when <kendo.ui.MultiSelect>.value() is passed an empty array to clear selected.

kendo.all.js:41785 Uncaught TypeError: l.select(...).done is not a function
    at init._removeTag (kendo.all.js:41785)
    at init._tagListClick (kendo.all.js:41795)
    at HTMLSpanElement.r (jquery?v=JL596WEzEYSLK79KRL4It4N63VXpRlW4A824KHlhVLc1:1)
    at HTMLUListElement.dispatch (jquery?v=JL596WEzEYSLK79KRL4It4N63VXpRlW4A824KHlhVLc1:1)
    at HTMLUListElement.a.handle (jquery?v=JL596WEzEYSLK79KRL4It4N63VXpRlW4A824KHlhVLc1:1)
_removeTag @ kendo.all.js:41785
_tagListClick @ kendo.all.js:41795
r @ jquery?v=JL596WEzEYSLK79KRL4It4N63VXpRlW4A824KHlhVLc1:1
dispatch @ jquery?v=JL596WEzEYSLK79KRL4It4N63VXpRlW4A824KHlhVLc1:1
a.handle @ jquery?v=JL596WEzEYSLK79KRL4It4N63VXpRlW4A824KHlhVLc1:1

 

This is the Htmlhelper generated markup:

<div class="k-widget k-multiselect k-multiselect-clearable" unselectable="on" title="" style="">
   <div class="k-multiselect-wrap k-floatwrap" unselectable="on">
      <ul role="listbox" unselectable="on" class="k-reset" id="OwnerPermissions_taglist">
        <li class="k-button" unselectable="on">
          <span unselectable="on">Stacy (stacyp)</span>
          <span unselectable="on" aria-label="delete" class="k-select">
          <span class="k-icon k-i-close"></span></span>
        </li>
     </ul>
     <input class="k-input" style="width: 25px" accesskey="" autocomplete="off" role="listbox" title="" aria-expanded="false" tabindex="0" aria-describedby="OwnerPermissions_taglist" aria-owns="OwnerPermissions_taglist OwnerPermissions_listbox" aria-disabled="false" aria-busy="false">
        <span unselectable="on" class="k-icon k-clear-value k-i-close" title="clear" role="button" tabindex="-1"></span>
        <span class="k-icon k-i-loading k-hidden"></span>
   </div>
<select id="OwnerPermissions" multiple="multiple" name="OwnerPermissions" data-role="multiselect" aria-disabled="false" style="display: none;">
   <option value="0">Owner Not Set</option>
   <option value="15336">Brian (brianc)</option>
   <option value="62278" selected="">Stacy (stacyp)</option>
</select>
<span style="font-family: "Open Sans", sans-serif; font-size: 12px; font-stretch: 100%; font-style: normal; font-weight: 400; letter-spacing: normal; text-transform: none; line-height: 24.8571px; position: absolute; visibility: hidden; top: -3333px; left: -3333px;">
</span>

</div>

<script>
    kendo.syncReady(function(){jQuery("#OwnerPermissions").kendoMultiSelect({"select":onSelectOwnerPermissions,"dataSource":{"transport":{"read":{"url":"/Context/GetAppUsers","data":function() { return kendo.ui.MultiSelect.requestData(jQuery("#OwnerPermissions")); }},"prefix":""},"serverFiltering":true,"filter":[],"schema":{"errors":"Errors"}},"dataTextField":"Text","dataValueField":"Value","value":[62278]});});
</script>
 

Note: The logic of the onSelectOwnerPermissions function the select event is bound to commented out to isolate the issue to it was left out of this post for brevity.

 

Ianko
Telerik team
 answered on 19 Oct 2018
1 answer
2.7K+ views

I have an application where jquery validation is used. On a page I have to display some double numbers with formatting. The template used for doubles is the same for all values @Html.Kendo().TextBoxFor(model => model).HtmlAttributes(ViewData).

I have searched and it seems there is no way to format the number, however I see that the TextBoxBuilder has a property called Format. However this does not do anything.

What is the point of the property Format?

Ivan Danchev
Telerik team
 answered on 17 Oct 2018
4 answers
390 views

I have a simple form:

@Model MyViewModel

<form method="post" action='@Url.Action("Submit")'>

    <div class="demo-section k-content">

        @Html.TextBoxFor(x => x.SomeRequiredField);

        @(Html.Kendo().Upload() .Name("files") .HtmlAttributes(new { aria_label = "files" }) )

        <p style="padding-top: 1em; text-align: right"><input type="submit" value="Submit" class="k-button k-primary" /></p>

    </div>

</form>

 

public ActionResult Submit(MyViewModel vm, IEnumerable<HttpPostedFileBase> files){

    if(ModelState.Valid) {

        ... do stuff

    } else {

        return View(vm);

    }

}

 

If I select a bunch of files in my upload control, and push the Submit button, suppose validation failed and the view is posted back, however my selected files are lost and I have to reselect them.

How do I restore the previously selected files in the file upload control (synchronous mode) when the form fails validation and is posted back?

 

Nencho
Telerik team
 answered on 15 Oct 2018
1 answer
150 views

The grid ignore case sensitive by default. But when i try to export excel by server side, the datas are filtered but without ignoring the case.
Any thing to do ?

 

 @(Html.Kendo().Grid(Model)
        .Name("grid")
        .ToolBar(toolbar =>
        {
        toolbar.Template(@<text>
            <a class='k-button k-grid-export' title='Export to XLS'>Export vers Excel</a>
        </text>);
        })
        .Columns(columns =>
        {

      columns.Bound(prat => prat.FirstName);
            columns.Bound(prat => prat.LastName);

}

.ColumnMenu()

.Groupable()
.Excel(excel => excel.FileName("Stat.xlsx").Filterable(true).AllPages(true))
.DataSource(dataSource => dataSource
            .Ajax()
            .Model(model => model.Id(p => p.GUIDReference))
            .Read(read => read.Action("DataRead", "BackOffice"))
            .ServerOperation(false)
            )

 

$(".k-grid-export").on("click", function (e) {
            exportToExcel('XLSX');
        });

 function exportToExcel(format) {
            var grid = $("#grid").data("kendoGrid");

            var filteredDataSource = new kendo.data.DataSource({
                data: grid.dataSource.data(),
                filter: grid.dataSource.filter(),               
            });

            filteredDataSource.read();
            var filteredData = filteredDataSource.view();

            var exportOption = {
                format: format,
                title: "Export",
                createUrl: "/BackOffice/Export",
                downloadUrl: "/BackOffice/Download"
            }

            data = {                
                model: JSON.stringify(grid.columns),
                data: JSON.stringify(filteredData.toJSON()),
                format: exportOption.format,
                title: exportOption.title
            };

            $.post(exportOption.createUrl, data, function () {
                window.location.replace(kendo.format("{0}?format={1}&title={2}",
                    exportOption.downloadUrl,
                    exportOption.format,
                    exportOption.title));
            });
        }

Tsvetina
Telerik team
 answered on 15 Oct 2018
2 answers
304 views

I am trying to implement a DropDownTree on a Grid Editing Popup.

 

1: I am unable to make the DefaultValue work. I am using an ID Like so: m.Field(p => p.treeID).DefaultValue(3)

2: Selecting another value in the tree does not seem to change the value in the related Grid Cell.

 

Veselin Tsvetanov
Telerik team
 answered on 15 Oct 2018
2 answers
869 views

I am a little surprized to see that the dropdowntree selects values with string values rather than with id's. 

 

What if you have the same string value more than once in the tree?

 

How can I set the value of the dropdowntree with an id?

Veselin Tsvetanov
Telerik team
 answered on 15 Oct 2018
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
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?