Telerik Forums
UI for ASP.NET MVC Forum
1 answer
308 views

In a normal form which uses html validation adding required to a KendoDropDownList fails

 

Ive tried to research to find a solution, but its due to the field being hidden field behind the control

Thus you end up with an error similar to this

An invalid form control with name='CountryId' is not focusable. 

 

I wish to know the proper way to show a validation message for a required dropdownlist in MVC

Ivaylo
Telerik team
 answered on 11 Jul 2024
1 answer
75 views
In my ASP.NET  MVC existing project we have used trail Telerik UI for ASP.NET  MVC version 2022.1.119.545 and after that we have upgraded to developer version 2022.2.510.545 we have facing issue with dropdown with multi select checkbox not working in developer version
Eyup
Telerik team
 answered on 11 Jul 2024
1 answer
105 views
Hello,
I am currently converting kendo external template to CSP template. Below is the code for the CSP template

Html.Kendo().Template().AddComponent(tabStrip => tabStrip.TabStrip()
        .Name("ed_${data.TabGuid}")
        .SelectedIndex(0)
        .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
        .HtmlAttributes(new { gridName = "Grid" + id)
        .Events(ev => ev.Activate("tabEvent"))
        .Items(items => items.Add().Text("TabName")
            .LoadContentFrom(Url.Action("ControllerName", "ActionName",
                    new
                    {
                        param= "${data.Property1}",  
                        param1= false,
                        param2= false,
                        param3= false
                    })))
    );

The current URL forming is considering ${data.Property1} as a string in the content URL formed in the kendo deferred script.
Is there any way that it could consider ${data.Property1} as a template literal inside contentUrl?
Alexander
Telerik team
 answered on 05 Jul 2024
1 answer
115 views
I need to control access, through the session credentials of my web application, to some pdf files that IIS has in order to only allow access to said resource if I am logged into the app.
I am researching to implement this with 'Forms Authentication' I don't know if this is the best option or maybe I should consider 'Basic Authentication' or JWT.
Tsvetomila
Telerik team
 answered on 03 Jul 2024
1 answer
71 views

When a treeview is first rendered is displays an animation indicating data is being loaded. I ahve a treeview that initially doesn't contain data, and only shows data after a user has entered a search.

I can refresh the treeview using   $("#treeview").data("kendoTreeView").dataSource.read();  but no animation is shown. I would have thought it would have been logical to show an animation as default behaviour, matching the grid and other controls.

How can I enable the animation on this call please?

Eyup
Telerik team
 answered on 02 Jul 2024
1 answer
187 views

We recently uprevved to the 2024.2.514 version of kendo ui and there appears to be a defect with manually handling the export excel event from a grid. We need to be able to show a hidden column so it appears in the export, then hide it again.

Previously we were able to call e.preventDefault, show the column, and call e.sender.saveAsExcel() before hiding the column and it worked. Now when we do this the "exporting ..." overlay remains. If I use jquery to remove the overlay the export button does not work when clicked a second time.

Our example is in razor and actually functions better than this jquery example below which doesn't even save the file.

https://dojo.telerik.com/oMEpuDAY

In other words the following code from https://docs.telerik.com/kendo-ui/knowledge-base/grid-include-hidden-columns-in-excel-export doesn't work anymore.

var exportFlag = false;
$("#grid").data("kendoGrid").bind("excelExport", function (e) {
    if (!exportFlag) {
        e.sender.showColumn(1);
        e.preventDefault();
        exportFlag = true;
        setTimeout(function () {
            e.sender.saveAsExcel();
        });
    } else {
        e.sender.hideColumn(1);
        exportFlag = false;
    }
});
Alexander
Telerik team
 answered on 20 Jun 2024
1 answer
215 views

I am trying to add a new form to an existing ASP.NET MVC 5  application (.NET Framework). I have been unable to get the TimePicker control to return the value set in the UI. The control renders correctly and shows the values I would expect. But when I submit the form, the model's property value linked to the TimePicker is always all zeros or null. What am I doing wrong here?

Example code:

Model.cs

public class TestModel
{
  public TimeSpan Start { get; set; }
}

TestController.cs

public class TestController : Controller
{
  public ActionResult Index()
  {
    TestModel testModel = new TestModel();
    testModel.Start = new TimeSpan(7, 30, 0);
    return View("Schedule", testModel);
  }

  [HttpPost]
  public ActionResult Schedule (TestModel schedule)
  {
    // I intend to save 'schedule' value to database here.
    // but schedule.Start property is always [0, 0, 0]
    // If TestModel.Start is defined as TimeSpan?, then the property is always null
    ...
    return RedirectToAction(...);
  }
}

Schedule.cshtml

@model TestModel
@{
  Layout = "~/Views/Shared/_Layout.cshtml"
}

@using (Html.BeginForm("Schedule", "TestController", FormMethod.Post))
{
    <div class="form-horizontal container-fluid" style="margin-left:15px;">

        <div class="row">
            @Html.Label("Start Time")
            @(Html.Kendo().TimePickerFor(m => m.Start).Name("Start").HtmlAttributes(new { @style = "width:100px;" }))
        </div>
        <div class="row">
            <input type="submit" value="Save" class="btn btn-primary" />
        </div>
    </div>
}

 

I have tried a variety of different MVC ways to instantiate the TimePicker:  TimePickerFor (as above) or just TimePicker, defining .Name() property or not, defining .Value(model.Start) or not, adding .Min & Max properties. The result in the Schedule controller is the same: no value assigned to any TimePicker control.

The other thing I tried was change the TestModel.Start property to DateTime. Doing that, the form submit is always short-circuited, apparently because of a model validation issue in the TImePicker control. Form focus always changes to the TimePicker control. I have not been able to view the actual validation error.

Hoping someone can identify the problem with my code. The TimePicker control seems ideal for the application I have in mind but if I can't get it working I'll have to do something else.

I am testing this code in VS 2022. The version of Kendo our application uses is older: v2022.1.301.

FYI, our application already uses a wide variety of Kendo controls including Grid, DateTimePicker, DropDownList and several others. We have not had trouble using those controls. But as far as I can tell, this is the first instance of TimePicker being added.

Thanks,
Jeff

Mihaela
Telerik team
 answered on 20 Jun 2024
5 answers
2.2K+ views

Hi,

I have a kendo MVC grid in a page.in that page i have button. when i click button i want to open a kendowindow popup.

so here is my issue.

when i am clicking that button am saving grid values and  i am opening kendo window popup. so if i have a errors in grid then i dont want to open kendow window popup. how to achieve this.  below is my button click code.

 $("#btnAddProject").click(function (e) {
            var grid = $("#Grid").data("kendoGrid");
            grid.saveChanges();

            var myWindow = $("#AddProjectWindow");
            myWindow.data("kendoWindow").open();
            myWindow.data("kendoWindow").center();
        });

Michael
Top achievements
Rank 2
Iron
 answered on 20 Jun 2024
1 answer
81 views

Please see the code i have and sorting is not working and If I server operation to false then data is not loading

 

-------------------------------

                @(Html.Kendo().Grid<LifeLabs.FIT.Web.RequisitionFileViewModel>()
                                                                        .Name("problemQueue-no-followups-grid")
                                                                        .EnableCustomBinding(true)
                                                                        .Columns(columns =>
                                                                        {
                                                                            columns.Bound(c => c.OrderId).Hidden();
                                                                            columns.Bound(c => c.FormatedOrderCode).Title("Order Code").Width(85);
                                                                            columns.Bound(c => c.AccessionNumber).Title("Accession#").Width(85);
                                                                            columns.Bound(c => c.Physician).Title("Requester Name").Width(110).Sortable(true);
                                                                            columns.Bound(c => c.CreatedOn).ClientTemplate("#= moment(CreatedOn).add(moment().utcOffset(), 'minutes').format('YYYY/MM/DD HH:mm:ss') #").Width(110);
                                                                            columns.Bound(c => c.UpdatedOn).ClientTemplate("#= moment(UpdatedOn).add(moment().utcOffset(), 'minutes').format('YYYY/MM/DD HH:mm:ss') #").Title("Moved to Queue").Width(110);
                                                                            columns.Bound(c => c.Status)
                                                                            .ClientTemplate("#if(IsLocked){#<div>#=Status#</div>#}else{if(isLongTermFollowUp==1){#<div style='background-color:red'><a href='/Order/EditRequisition?id=+#=OrderId#&Queue=3'>#=Status#</a></div>#}    else{#<div><a href='/Order/EditRequisition?id=+#=OrderId#&Queue=3'>#=Status#</a></div>#}}#").Width(65);
                                                                            columns.Bound(c => c.IsLocked).Title("Locked").Width(50)
                                                                            .ClientTemplate("#if(IsLocked){#<div><i class='fa fa-check'></i></div>#}else{#<div></div>#}#");
                                                                            columns.Bound(c => c.UserNote).Title("Notes").Sortable(true).Width(200);
                                                                            //columns.Bound(c => c.isLongTermFollowUp).Title("Long Term F/U").Width(125)
                                                                            //.ClientTemplate("#if(isLongTermFollowUp){#<div><i class='fa fa-check'></i></div>#}else{#<div></div>#}#");
                                                                        })
                                                                        //.ClientRowTemplate("#if(isLongTermFollowUp==1) {#<tr style='background-color:red' data-uid='#= uid #'></tr>#}")
                                                                        .HtmlAttributes(new { style = "height: 430px;" })
                                                                        .Scrollable()
                                                                        .Sortable(sorting => sorting.Enabled(true))
                                                                        .Pageable(pageable => pageable
                                                                        .Refresh(true)
                                                                        .PageSizes(true)
                                                                        .ButtonCount(5))
                                                                        .DataSource(dataSource => dataSource
                                                                        .Ajax()
                                                                        .Read(read => read.Action("GetProblemQueueList", "ProblemQueue", new { type = "no" }))
                                                                        .ServerOperation(true)
                                                                        )
                )
Alexander
Telerik team
 answered on 18 Jun 2024
1 answer
91 views
I am using a kendo popup window as a form to edit items on a grid. If there are errors with defining the properties if should return to the window with error messages. This is Controller action. Currently if the modelstate is not valid it returns a view without and styling (just Html)> If I return View instead of Partial the page loads correctly but as a full page and not a window
public ActionResult EditActivity(EditActivity model)
		{
			var activity = _uow.Activities.GetById(model.ActivityId);

			activity.Phone = model.Phone;
			activity.Fax = model.Fax;
			activity.LastUpdateDate = DateTime.Now;
			activity.LastUpdatedBy = _sessionHandler.UserId;
			if (ModelState.IsValid)
			{
				try
				{
                    _uow.Activities.Update(activity);
                    _uow.Commit();
                    TempData["SaveResultMessage"] = $"Changes to Activity : {activity.ActivityName} have been saved";
                }
				catch
				{
                    ModelState.AddModelError("Save", "Error occurred on save.");
                }

				return RedirectToAction("Index", "DepartmentActivity", new
				{
					id = activity.DepartmentId,
				});
			}

			return View(model);

Alexander
Telerik team
 answered on 07 Jun 2024
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
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
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
DateTimePicker
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?