Telerik Forums
UI for ASP.NET MVC Forum
2 answers
503 views

Hi,

I want to use my own Editor (PartialView) to edit row's from my Kendo MVC grid
(not use the build in template editing because off the limitations with the layout like save and cancel button location etc.)
attached you can see a Picture off my editing form (it uses i.e also Kendo Toolbar with save button...)

My question is: what is the best approach to implement this?

I have found two possibilities to solve this but not sure if these are good Solutions:

  1. Load the PartialView with the Kendo window without binding to the grid data but select the data in the Controller and use that model binding
    window.refresh({
            url: "/Mitglied/Fachgruppenzugehoerig/_Edit/",
            data: {
                mitgliedid: dataitem.Mitglied_ID,
                berechtigungid: dataitem.Berechtigung_ID,
                sparteid: dataitem.Sparte_ID,
                fachgruppeid: dataitem.Fachgruppe_ID,
                fachgruppesubid: dataitem.FachgruppeSub_ID,
                fachgruppeversionid: dataitem.Fachgruppe_Version_ID,
                berufsgruppeid: dataitem.Berufsgruppe_ID,
                berufsgruppeversionid: dataitem.Berufsgruppe_Version_ID
            }

in the partial view I use normal razor Syntax to bind to the model:

...
<div>
<label class="col-sm-3 control-label">Rechtsw.datum:</label>
    <div class="col-sm-4">
    @(Html.EditorFor(m => m.Rechtswirksamkeitsdatum, ""))
    @Html.ValidationMessageFor(model => model.Rechtswirksamkeitsdatum)
</div>

with this approach i have to refresh the grid after data changes...

2. Load the PartialView with the Kendo window and use "Kendo.bind" to bind the controls to the valus of the Kendo grid:

var grid = $("#grid").data("kendoGrid");
var dataItem = grid.dataItem(grid.select());
kendo.bind($('#externaleditor'), dataItem);

here in the partial view I use different razor Syntax to bind to the grid values (see data_bind = "value: Rechtswirksamkeitsdatum") :

<label class="col-sm-3 control-label">Rechtsw.datum:</label>
                <div class="col-sm-4">
                    @(Html.TextBox("Rechtswirksamkeitsdatum", "", new { data_bind = "value: Rechtswirksamkeitsdatum", @class = "k-textbox" }))
                    @Html.ValidationMessageFor(model => model.Rechtswirksamkeitsdatum)
                </div>

 

robert

 

Robert Madrian
Top achievements
Rank 1
Veteran
Iron
 answered on 21 Nov 2016
3 answers
176 views

We have a set up where we have a grid in a dialog and are trying to fire a simple action ...

So the end configuration on the dialog looks like this ..

.Actions(actions =>
{
actions.Add().Text("Cancel");
actions.Add().Text("OK").Primary(true).Action("onActionOK");
})

 

the function is a pretty simple one right now.. just trying to make sure it is hit

function onActionOK(e) {
console.log("actionOK event");

}

 

But this is never hit and there are no messages in the console.... is there an alternate way that I should be defining the action?

 

Thanks
AJ

Rumen
Telerik team
 answered on 18 Nov 2016
3 answers
123 views
Hi,
I'd like to know how can I show DropDownList as the default control type for specific column in GridView control on its initial loading instead of showing the default label in each row for specific column.
I'm using in-cell edit mode and I followed your demos to show DropDownList for specific column by using ClientTemplate and ForeignKey Column Type ..Its working good, However, I'd like to show this DropDownList always for this columns in all rows in GridView initial loading not only when focus on the related cell.

View.cshtml:

@(Html.Kendo().Grid<MyModels.Models.ViewModels.ProductCategoryViewModel>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.ProductName);
        columns.Bound(p => p.Category).ClientTemplate("#=Category.CategoryName#").Width(160);
        columns.Bound(p => p.UnitPrice).Width(120);
        columns.Command(command => command.Destroy()).Width(90);
    })
    .ToolBar(toolBar =>
        {
            toolBar.Create();
            toolBar.Save();
        })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Pageable()
    .Sortable()
    .Scrollable()
    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Events(events => events.Error("error_handler"))
        .Model(model =>
        {
            model.Id(p => p.ProductID);
            model.Field(p => p.ProductID).Editable(false);
        })
        .PageSize(20)
                .Read(read => read.Action("GetAllProductsAndRelatedCategories", "Product"))
                .Create(create => create.Action("AddProductsAndRelatedCategories", "Product"))
                .Update(update => update.Action("UpdateProductsAndRelatedCategories", "Product"))
                .Destroy(destroy => destroy.Action("RemoveProductsAndRelatedCategories", "Product"))
    )
)

Eyup
Telerik team
 answered on 18 Nov 2016
9 answers
406 views
Does the scheduler have drag and drop capability?  If so, is there an example or documentation on how to implement drag and drop?
Vladimir Iliev
Telerik team
 answered on 17 Nov 2016
7 answers
314 views

I have a Telerik MVC Grid with server binding. I configure it to have an 'all' page size option. The page size selection works and when I pick 'all' it does show all the records but the selected page size value in the dropdown resets to default. Is this a bug or I'm doing something wrong? Is there a workaround for this? I've attached an example project (excluded Kendo components from the archive). 

Thank you.

Nik

Pavlina
Telerik team
 answered on 17 Nov 2016
1 answer
128 views

I have a grid that has a command edit , I would like to retrieve the new text in the events.Save("onEdit")) javascript.

I cannot see how to do this, and cannot locate any samples in the forms.

 

My current function and grid is below.  How can I retrieve the data from the email address when the update button is selected in edit more.

 

function onEdit(e) {
e.preventDefault();
alert("save 1");
var grid = $("#siteManagementNotifications").data("kendoGrid");
var tr = $(e.target).closest("tr");
var data = this.dataItem(tr);
alert(data.emailAddress);

}

 

@(Html.Kendo().Grid<WebSite.Library.Models.SiteNotifications>()
.Name("siteManagementNotifications")
.Columns(columns =>
{
columns.Bound(p => p.siteId).Title("Id").Width(50).Hidden();
columns.Bound(p => p.siteNotificationId).Title("Id").Width(50).Hidden();
columns.Bound(p => p.siteNotification).Title("Type").Width(50);
columns.Bound(p => p.emailAddress).Title("Notification").Width(120).EditorTemplateName("TextBoxEditor");
//columns.Command(command => command.Custom("Save").Click("SaveSiteNotification")).Width(180);
columns.Command(command => { command.Edit(); }).Width(250);
})

.Events(events => events.Save("onEdit"))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.NoRecords("No notifications exist.")
.DataSource(source => source
.Custom()
.Schema(schema => schema
.Model(m => m.Id(p => p.siteNotificationId)))
.Transport(transport => transport
.Read(read =>
{
read.Url("/Api/SiteInfo/_getNotifications/" + Model.SiteId)
.DataType("json");
})
))
)

Konstantin Dikov
Telerik team
 answered on 17 Nov 2016
1 answer
115 views
Hi,  How to set  Kendo Grid scrollable: virtual: false with javascript after grid databound successfull, i tried that  $("#grid").kendoGrid({scrollable: {virtual: false},});  but it is not working. I want to change it dynamically. Please Help.
Stephen
Top achievements
Rank 2
 answered on 16 Nov 2016
14 answers
677 views

I'm having trouble selecting the entire cell when editing a grid in InLine mode.  I want the entire cell selected to make entering a new value easier.

I tried adding the onEdit event.  But the onEdit event fires when the Edit button is clicked.

For grids that are batch edit, I've been able to have the onEdit event fire javascript to select the entire cell.  This is how I'm doing it for a grid in batch mode.  I assume it will be similar, but I'm struggling with it.  Thanks for your help.

 

function onEdit(e) {
 
    var inputName = e.container.find('input').attr("name");
 
    var myInput = e.container.find('input[name="' + inputName + '"]');
 
    myInput.select();
 
}

Terry
Top achievements
Rank 1
 answered on 16 Nov 2016
1 answer
11.3K+ views
i'm using 
grid.dataSource.transport.options.read.url = "addr here";
grid.dataSource.read();
to reload the grid and was wondering how do i know when it's done reloading and is fully displayed?
There does not seem to be an event for it ?
Is there a work around?

Thanks in advance!
Dimo
Telerik team
 answered on 16 Nov 2016
1 answer
229 views

Hi,

I have an upload control that the validation is not working on.  I am setting it to restrict to .jpg only and 2mb but the save action is called no matter what I upload to it.

@(Html.Kendo().Upload()
    .Events(e => e.Success("onParent1UploadSuccess"))
    .Async(a => a
        .AutoUpload(true)
        .Save("SaveParent1", "HistoryForm", new { AdmissionPK = Model.AdmissionPK })
    )
    .ShowFileList(false)
    .Multiple(false)
    .Name("Parent1Upload")
    .Validation(v => v
        .AllowedExtensions(new string[] { ".jpg" })
        .MaxFileSize(2097152)
    )
    .Messages(m => m.Select("Select File..."))
)

 

How do I get the validation to actually work?

Thanks.

Dimiter Madjarov
Telerik team
 answered on 16 Nov 2016
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
DateTimePicker
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
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
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
Iron
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?