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

Hi,

I use a Edit Template for the popup edit in my grid and it works fine except that if I change something and click save without closing the window the changes from the database (there are some computed columns) are reflecting in the grid but not in the popup - why?
(see also attached Pictures BeforeSave.jpg and AfterSave.jpg)

Isn't the popup window bind with MVVM in two way binding so changes in the grid should reflect in the window?

Robert

here is the html for the Template

<div class="container-fluid">
    <div class="form-horizontal" style="width:750px" id="formFachgruppenzugehörig" name="formFachgruppenzugehörig">
        @(Html.HiddenFor(m => m.Mitglied_ID, ""))
        @(Html.HiddenFor(m => m.Berechtigung_ID, ""))
        @(Html.HiddenFor(m => m.Sparte_ID, ""))
        @(Html.HiddenFor(m => m.Fachgruppe_ID, ""))
        @(Html.HiddenFor(m => m.FachgruppeSub_ID, ""))
        @(Html.HiddenFor(m => m.Fachgruppe_Version_ID, ""))
        @(Html.HiddenFor(m => m.Berufsgruppe_ID, ""))
        @(Html.HiddenFor(m => m.Berufsgruppe_Version_ID, ""))
        @(Html.HiddenFor(m => m.RowVersion, ""))
        @(Html.HiddenFor(m => m.Timestamp, ""))
         
         
        <div class="row p-h-xs">
            <div class="form-group m-xxs">
                <label class="col-sm-3 control-label">Sparte:</label>
                <div class="col-sm-9">
                    <p class="gpdbform-control-static">
                        <span class="label label-success pull-right">@(Html.ValueFor(m => m.Sparte_ID, ""))</span>
                        <span data-bind="text: Sparte"></span>
                    </p>
                </div>
            </div>
            <div class="form-group m-xxs">
                <label class="col-sm-3 control-label">Fachgruppe:</label>
                <div class="col-sm-9">
                    <p class="gpdbform-control-static">
                        <span class="label label-success pull-right">@(Html.ValueFor(m => m.Fachgruppe_ID, ""))</span>
                        <span data-bind="text: Fachgruppe"></span>
                    </p>
                </div>
            </div>
            <div class="form-group m-xxs">
                <label class="col-sm-3 control-label">Berufsgruppe:</label>
                <div class="col-sm-9">
                    <p class="gpdbform-control-static">
                        <span class="label label-success pull-right">@(Html.ValueFor(m => m.Berufsgruppe_ID, ""))</span>
                        <span data-bind="text: Berufsgruppe"></span>
                    </p>
                </div>
            </div>
            <hr class="light"/>
            <div class="form-group m-xxs">
                <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>
                <label class="col-sm-4 control-label">Hauptbetreuende Fachgruppe:</label>
                <div class="col-sm-1">
                    <div class="checkbox">
                        <label>
                            @(Html.EditorFor(m => m.Hauptbetreuung, ""))
                        </label>
                    </div>
                </div>
            </div>
            <div class="form-group m-xxs">
                <label class="col-sm-3 control-label">gelöscht:</label>
                <div class="col-sm-4">
                    @(Html.EditorFor(m => m.gelöscht, ""))
                    @Html.ValidationMessageFor(model => model.gelöscht)
                </div>
                <label class="col-sm-4 control-label">Hauptgewerbe:</label>
                <div class="col-sm-1">
                    <div class="checkbox">
                        <label>
                            @(Html.EditorFor(m => m.Hauptgewerbe, ""))
                        </label>
                    </div>
                </div>
            </div>
            <div class="form-group m-xxs">
                <label class="col-sm-3 control-label">Aktuell:</label>
                <div class="col-sm-4">
                    <div class="checkbox">
                        <label>
                            @(Html.EditorFor(m => m.Aktuell, ""))
                        </label>
                    </div>
                </div>
                <label class="col-sm-4 control-label">Hauptgremium:</label>
                <div class="col-sm-1">
                    <div class="checkbox">
                        <label>
                            @(Html.EditorFor(m => m.Hauptgremium, ""))
                        </label>
                    </div>
                </div>
            </div>
            <div class="form-group m-xxs">
                <div class="col-sm-6">
                </div>
                <label class="col-sm-5 control-label">Nebengremium:</label>
                <div class="col-sm-1">
                    <div class="checkbox">
                        <label>
                            @(Html.EditorFor(m => m.Nebengremium, ""))
                        </label>
                    </div>
                </div>
            </div>
            <hr class="light"/>
            <div class="form-group m-xxs">
                <label class="col-sm-3 control-label"><small class="text-muted">angelegt:</small></label>
                <div class="col-sm-3">
                    <p class="gpdbform-control-static">
                        <small class="text-muted"><span data-format="dd.MM.yyyy hh:mm:ss" data-bind="text: angelegt"></span></small>
                    </p>
                </div>
                <label class="col-sm-3 control-label"><small class="text-muted">Mitglied_ID:</small></label>
                <div class="col-sm-3">
                    <p class="gpdbform-control-static">
                        <small class="text-muted"><span data-bind="text: Mitglied_ID"></span></small>
                    </p>
                </div>
            </div>
            <div class="form-group m-xxs">
                <label class="col-sm-3 control-label"><small class="text-muted">geändert:</small></label>
                <div class="col-sm-3">
                    <p class="gpdbform-control-static">
                        <small class="text-muted"><span data-format="dd.MM.yyyy hh:mm:ss" data-bind="text: geändert"></span></small>
                    </p>
                </div>
                <label class="col-sm-3 control-label"><small class="text-muted">Berechtigung_ID:</small></label>
                <div class="col-sm-3">
                    <p class="gpdbform-control-static">
                        <small class="text-muted"><span data-bind="text: Berechtigung_ID"></span></small>
                    </p>
                </div>
            </div>
            <div class="form-group m-xxs">
                <label class="col-sm-3 control-label"><small class="text-muted">Benutzer:</small></label>
                <div class="col-sm-3">
                    <p class="gpdbform-control-static">
                        <small class="text-muted"><span data-bind="text: Benutzer"></span></small>
                    </p>
                </div>
            </div>
        </div>
 
    </div>
</div>

Robert Madrian
Top achievements
Rank 1
Veteran
Iron
 answered on 21 Nov 2016
2 answers
564 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
221 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
160 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
471 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
369 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
162 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
182 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
765 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.5K+ 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
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
DropDownButton
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
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
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?