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

The data is displayed in my nested grid (binds to the main grid's collection property) inside the main grid's editor template. But when I try to add/update the data the editor template is found but not displayed correctly. For some reason it just shows 0 instead of the editor template content. What could be the problem here?

p.s. Found this on the forum:

When you are trying to load a helper that will contain templates in another template (in this case the Popup template of the main Grid), you need to ensure that you are calling the ToClientTemplate method over the nested helpers. This should resolve the escaping in the templates and it should resolve the problem that you are facing

So I've added ToClientTemplate() to my nested grid & tried adding it to the helpers inside the nested grid's popup editor but this changes nothing,the problem is the same.

Valeria
Top achievements
Rank 1
 updated question on 18 Jan 2022
1 answer
344 views
I have this inside my grid popup editor view:

@model App.UI.Web.Models.SuitViewModel

 

@(Html.Kendo().DropDownTreeFor(x => x.subjectid) .Name("subjectsDDT") .HtmlAttributes(new { style = "width: 500px;" }) .DataSource(ds => ds.Read("ReadDropDownTreeSubjects", "BaseDirectory") ) .Placeholder("Select subject...") .Filter("contains") .DataTextField("name") .DataValueField("id") .ValuePrimitive(true) .ClearButton(false) .Events(ev => ev.Select("watch")) )


The subjectid property of SuitViewModel view model must be equal to the id of the item selected in the dropdowntree but i always receive 0 in my controller. Where is the problem here?
Eyup
Telerik team
 answered on 17 Jan 2022
1 answer
633 views

Hello,

I'm using Kendo Editor to handle the rich text content.  We have a strange issue when the pasted html contains the attribute value with the keyword " on". Please find below the description.

  1. Copy the content from external source (I have copied form G Sheets). Please find below:

<span data-sheets-userformat="{"2":15037,"3":{"1":0},"5":{"1":[{"1":2,"2":0,"5":{"1":2,"2":0}},{"1":0,"2":0,"3":3},{"1":1,"2":0,"4":1}]},"6":{"1":[{"1":2,"2":0,"5":{"1":2,"2":0}},{"1":0,"2":0,"3":3},{"1":1,"2":0,"4":1}]},"7":{"1":[{"1":2,"2":0,"5":{"1":2,"2":0}},{"1":0,"2":0,"3":3},{"1":1,"2":0,"4":1}]},"8":{"1":[{"1":2,"2":0,"5":{"1":2,"2":0}},{"1":0,"2":0,"3":3},{"1":1,"2":0,"4":1}]},"10":2,"12":0,"14":{"1":2,"2":0},"15":"Calibri","16":11}" data-sheets-value="{"1":2,"2":"Just once"}" style="font-size:11pt;font-family:Calibri, Arial;">Just once</span><br />

  1. There is no issue while pasting the content. Pasted content displays properly.
  2. Save the form and load the data from database, there is the below issue in the browser console.

Uncaught DOMException: Failed to execute 'setAttribute' on 'Element': 'k-script-once"}"' is not a valid attribute name.

Problem appears to be in the function "_preventScriptExecution" and the statement :  this.setAttribute('k-script-' + name, attribute.value);

Note: This issue happens ONLY when we have html and the attributes are having the keyword " on" (“space” followed by text “on”)

Example:

attribute="{"key":" on"}"

data-sheets-value="{"2":"Just once"}"

I have attached the sample screenshots and the html input data.

Could you please let me know if there is a fix for this issue?

Thanks in advance for your feedback.

Regards,

Puru

Eyup
Telerik team
 answered on 17 Jan 2022
1 answer
287 views

I know how to call a client-side javascript function to get parameters to pass to the the controller for the various actions of a grid. But what if I need to call a javascript function that itself takes a parameter? How to I pass a value from the grid's action, data methods to the javascript function?

Thank you in advance for your advice.


//grid setup...

  .Create(update => update.Action("Add", "MyController).Data("GetParams"))
  .Update(update => update.Action("Update", "MyController").Data("GetParams"))
...

function GetParams(fSomeFlag) {
  var retVal;
  if (fSomeFlag = true)
    retVal = "someValForCreate";
  else
    retVal = "someValForUpdate";

    return {
        param1 : retVal,
        param2: "someOtherValue"
    };

Eyup
Telerik team
 answered on 17 Jan 2022
0 answers
205 views
I have a grid inside my grid editor template (subgrid). And both grids have popup editing. Right now the subgrids popup window shows as a part of the main grid editor template (right below the subgrid) and it doesn't show the title. How can I show it as a new window?
Valeria
Top achievements
Rank 1
 asked on 17 Jan 2022
1 answer
98 views

Hello, 

I have implemented the ASP.NET MVC Gantt into my project. I am having a slight issue when adding to the grid.

 

After adding, the entry for the Task shows a skinny bar with no text, when in fact database shows it does have text for the entry. Hovering over it shows the correct text. Picture below:

 

 

Refreshing the grid does not update it, although it appears totally correct in the database. Thanks for any help. Side question - how can I change the theme of my grid? I saw there are many theme options.

Ivan Danchev
Telerik team
 answered on 14 Jan 2022
1 answer
455 views

Hi..

I am experiencing that when i create an event via the popup on scheduler, and save, a debug breakpoint placed in the Create method of the controller, can be observed to fire between 2 and 4 times. i checked the database and it indeed runs the whole save process 2 or 4 times with the same data.

My view has the following code:

<div id="citizenAppointmentCalender" class="calenderContainer">
	@(Html.Kendo().Scheduler<AppointmentTaskViewModel>()
		.Name("appointmentsCalender")
		.Height(820)
		.Editable(e => {
			e.TemplateName("CitizenAppointmentsEditorPartialView");
			e.EditRecurringMode(SchedulerEditRecurringMode.Series);
		})
		.DateHeaderTemplate("<strong>#=kendo.toString(date, 'ddd dd-MMM')#</strong>")
		.AllDaySlot(false)
		.Timezone("Europe/Copenhagen")
		.EventTemplate("<div class='eventBox' style='background-color:#= BackColor #; color:#= FontColor #;'><div class='eventInner'><span>#= title #</span></div><div class='eventInner'><span>#= description #</span></div></div>")
		.Views(views => {
			views.DayView();
			views.WeekView(x => x.Selected(true));
			views.MonthView();
		})
		.Events(x => {
			x.Edit("caed_Dialog_Edit");
			x.Save("caed_Dialog_Save");
		})
		.DataSource(d => {
			d.Model(m => { m.Id(f => f.ID); });
			d.Read(read => read.Action("Read", "CitizenDashboard").Type(HttpVerbs.Post));
			d.Create("Create", "CitizenDashboard");
			d.Destroy("Destroy", "CitizenDashboard");
			d.Update("Update", "CitizenDashboard");
		})
	)
</div>

 

The controller code:

public virtual JsonResult Create([DataSourceRequest] DataSourceRequest request, AppointmentTaskViewModel task) {
    if (ModelState.IsValid) {
	appointmentService.Insert(task, ModelState);
    }

    return Json(new[] { task }.ToDataSourceResult(request, ModelState));
}

 

Finally the javascript for the "edit" and "save" events:

function caed_Dialog_Edit(e) {
	$("#caed_eventType_private")[0].checked = false;
	$("#caed_eventType_medical")[0].checked = false;
	$("#caed_eventTypes_PrivateBox")[0].classList.add("hide");
	if (e.event.Type == 3) {
		$("#caed_eventType_private")[0].checked = true;
		$("#caed_eventTypes_PrivateBox")[0].classList.remove("hide");
	} else if (e.event.Type == 2) {
		$("#caed_eventType_medical")[0].checked = true;
	}
	var buttons = e.container[0].children[0].children[1];
	if (e.event.IsNexusAppointment) {
		$("#caed_Title")[0].setAttribute("disabled", "disabled");
		$("#caed_Description")[0].setAttribute("disabled", "disabled");
		$("#caed_startDate").data("kendoDateTimePicker").enable(false);
		$("#caed_endDate").data("kendoDateTimePicker").enable(false);
		$("#caed_eventType_medical")[0].setAttribute("disabled", "disabled");
		$("#caed_eventType_private")[0].setAttribute("disabled", "disabled");
		$("#caed_isPersonal")[0].setAttribute("disabled", "disabled");
		$("#caed_recurrence").data("kendoRecurrenceEditor").element[0].disabled = true;

		buttons.children[0].classList.add("hide"); // Save btn
		buttons.children[1].innerText = "OK";
		if (buttons.children.length >= 3)
			buttons.children[2].classList.add("hide"); // Delete btn

	} else {
		$("#caed_Title")[0].removeAttribute("disabled");
		$("#caed_Description")[0].removeAttribute("disabled");
		$("#caed_startDate").data("kendoDateTimePicker").enable(true);
		$("#caed_endDate").data("kendoDateTimePicker").enable(true);
		$("#caed_eventType_medical")[0].removeAttribute("disabled");
		$("#caed_eventType_private")[0].removeAttribute("disabled");
		$("#caed_isPersonal")[0].removeAttribute("disabled");
		$("#caed_recurrence").data("kendoRecurrenceEditor").element[0].disabled = false;

		buttons.children[0].classList.remove("hide"); // Save btn
		buttons.children[1].innerText = "Fortryd";
		if (buttons.children.length >= 3)
			buttons.children[2].classList.remove("hide"); // Delete btn
	}
}
function caed_Dialog_Save(e) {
	if (e.event.caed_eventType_radio)
		e.event.Type = parseInt(e.event.caed_eventType_radio);

	if (e.event.Type == 3) {
		e.event.IsPersonal = e.event.caed_isPersonal ? e.event.caed_isPersonal : false;
		e.event.BackColor = "#ffa500";
		e.event.FontColor = "#fff";

	} else if (e.event.Type == 2) {
		e.event.BackColor = "#F02222";
		e.event.FontColor = "#fff";
	}

	var scheduler = $("#appointmentsCalender").data("kendoScheduler");
	scheduler.dataSource.sync();
}

 

With these 3 snippets of code.. you can duplicate the issue. No need for a sample project. The "Insert" method simply puts the data from the model into an entity framework object and saveChanges is called, nothing more. But by then its already reproducible. 

So just make a new event and press save. Remember to put a breakpoint at the start of the create method.

 

HOW can i prevent this from happening?

Yanislav
Telerik team
 answered on 14 Jan 2022
1 answer
125 views

We're using a virtualized MultiColumnComboBox including the filter functionality 'contains'.

Unfortunately a filter on an integer field throws an error 'FormatException' on ToDataSourceResult

Is there a default way of making this work, or do we have to modify the DataSourceRequest manually?

If the latter, is there an example of how to do it?

Ivan Danchev
Telerik team
 answered on 12 Jan 2022
0 answers
132 views

a model is returned to the form in which parameter "Raion" bool has a value of true or false.
How to make it so that CheckBox itself takes the required value?

@(Html.Kendo().CheckBox().Name("Raion").Label("Выезд на район"))

public class ServiceViewModel
    {
*****
        public bool Raion { set; get; }
****
    }
@model service.Models.ServiceViewModel

@(Html.Kendo().CheckBox().Name("Raion").Label("Выезд на район"))




Вадим
Top achievements
Rank 1
Iron
Iron
 asked on 11 Jan 2022
1 answer
79 views

Good afternoon,

I've successfully managed to use PdfProcessing in a similar way to the demo but I want to include some error capture.  What's the best way to return the error to the View and display it e.g. if the file doesn't exist?

[HttpPost]
public ActionResult Download_Document()
{
    try
    {
        PdfFormatProvider formatProvider = new PdfFormatProvider();
        formatProvider.ExportSettings.ImageQuality = ImageQuality.High;

        byte[] renderedBytes = null;
        using (MemoryStream ms = new MemoryStream())
        {
            RadFixedDocument document = CreatePdfDocument.CreateDocument();
            formatProvider.Export(document, ms);
            renderedBytes = ms.ToArray();
        }

        return File(renderedBytes, "application/pdf", "PdfDocument.pdf");
     }
     catch (Exception e)
     {
         return e.Message;
     }
}

Kind regards,

Richard

Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
 answered on 10 Jan 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
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?