Telerik Forums
UI for ASP.NET MVC Forum
5 answers
1.0K+ views
Build: 2012.3.1413

When my batch grid is saved, I am trying to add items to a list property that is present on the grid's dataSource.  I am getting an accurate quantity of items inserted into this list property, but I am not getting any of the data that should be present with it.  The strange thing is that the values DO appear to be present when I use firebug to look at what is being sent to the server, but the data disappears on the object on the controller side (except for the appropriate number of entries)

ItemModel
public class ItemModel
 {
     public ItemModel()
     {
         ServiceBookList = new List<ServiceModel>();
     }
 
     public List<ServiceModel> ServiceBookList { get; set; }
}
ServiceModel
public class ServiceModel
{
    public ServiceModel() { }
 
    public int RefServiceID { get; set; }
    public string Value { get; set; }
    public string Code { get; set; }
 
    public long EnterpriseProductServiceBookID { get; set; }
    public long AppUserProductServiceBookID { get; set; }
    public bool IsDeleted { get; set; }
}
Script
function SaveProductBook() {
       //This is called when the "Save" button on the parent grid is clicked
     var productBook = $("#AdminProductBookGrid").data("kendoGrid");
     SaveProductDetailViews(productBook); //Save items located in detail template
     productBook.dataSource.sync();
 }
   
function SaveProductDetailViews(itemGrid) {
     //For each row in grid, grab the latest data from the fields within the detail templates
     //and update the row's dataSource prior to sync
     $.each($("#AdminProductBookGrid tbody tr"), function (index, row) {
         var dataItem = itemGrid.dataItem(row);
         var detailRow = $(row).next();
 
         if (dataItem != null && detailRow.has('.k-detail-cell').length > 0) {
             SaveServiceDetailViews(dataItem, detailRow, type);
         }
     });
 }
 
function SaveServiceDetailViews(dataItem, detailRow, type) {
     var serviceGrid = $(detailRow).find("div[id=ServiceGrid_" + dataItem.uid + "]").data("kendoGrid");
    //data is the item's added in the detail template's grid for that parent row
    var data = serviceGrid.dataSource._data;
     for(var i = 0; i < data.length; i++) {      
           //Add to the parent row's dataSource list
           dataItem.ServiceBookList.push(data[i]);
     }
 }
DataSource state prior to grid sync() - From Firebug
See image below, but the 1 attribute that should be populated is RefServiceID, and it is. 

Result on POST -from Firebug

See image below, but same as DataSource (ie. RefServiceID should be the only attribute populate in the sub list items and it is.
***Issue is possible here because the full path of the data in the list is written strangely, but I'm not sure if it is correct.
Full path to RefServiceID (after push function) is:
models[0].ServiceBookList[0][RefServiceID]
I figure it should look list other arrays and be like this (but not sure):
models[0].ServiceBookList[0].RefServiceID

Controller values
See Image Below


In case my description was insufficient, I have also included a screenshot of how everything is laid out in the application.

Please let me know if further code is needed.  Also, I began this when there was no out of the box support for saving editable fields in a grid's detail template.  Please let me know if this has changed and how I might go about doing it in a supported way.

Thanks!
Daniel
Telerik team
 answered on 22 Apr 2013
1 answer
284 views
Hi,

I have 2 problems with the code bellow. 

1) If I don't set the z-index in the CSS below, the "Select..." button does not do anything when clicked on.  With the CSS in place the click event works until I upload something, after which it no longer respond.  I'd have to reload the page to get it to work again.  Drag/drop files to the drop zone works fine and the files are uploaded properly.

2) When uploading, instead of uploading each file once, it uploads each file it at least 4 times (see attached image).

HTML:
<div id="dlgUpload" style="display:none">
    <p><span class="ui-icon ui-icon-info" style="float: left; margin: 0 7px 20px 0;"></span>Photo Upload</p>
    <div style="width:100%;max-height:300px;">       
        @(Html.Kendo().Upload()
            .Name("fileUpload")
            .Async(a => a
                .Save("Save", "Upload")
                .Remove("Remove", "Upload")
                .AutoUpload(true)
            )
            .Events(e => e
                .Upload(@<text>
                function(e) {   
                 e.data = { jobNumber: $("#Customer_Number").val(), mode:"photos" };
                }
              </text>)
                .Remove(@<text>
                function(e) {   
                 e.data = { jobNumber: $("#Customer_Number").val(), mode:"photos" };
                }
              </text>)
            )
        )
    </div>
</div>
function uploadPhotos(customerId) {
    $("#dlgUpload").dialog({
        autoOpen: false,
        resizable: false,
        draggable: true,
        modal: true,
        width: 470,
        title: "Upload Photos for Customer " + customerId,
        buttons: {
            "Close": function () {
                $(this).dialog("close");
            }
        },
    });
    $('#dlgUpload').dialog('open');
}
funtion uploadPhotos is called by buttons on a kendoGrid.

CSS:
.ui-dialog .k-upload-button  input
{
    z-index:auto !important;
}
When I take the upload widget out of the dialogbox everything works fine.

Update:
I seem to remember something about the widget being initialize twice when running inside a dialog box!
If you look at the second image, notice there are 2 drop zones (1 in red and 1 in yellow.)  When dropping on the red zone the file uploads 4 times, on the yellow zone it uploads 8 times!

Help!!

Thanks,
PT
Dimo
Telerik team
 answered on 22 Apr 2013
2 answers
208 views
I follow the examble on here , add the custom column which contain the Upload control , but when I add new row , the file which I selected before is removed.
The main idea is i want to post the form with all file that i select by Upload control in Kendo grid and the data source  of grid in server(it was success) by manual

Sorry because the souce file > 2m so i upload the file on mediafire
http://www.mediafire.com/?box80su08io5i64

Petur Subev
Telerik team
 answered on 22 Apr 2013
1 answer
124 views
Hello,
I am using Kendo UI Web with RequireJS in an ASP.MVC 4 application. Recently I reached the folowing situation:
In a form I am using MultiSelect control and I try to load required kendo components with requirejs using the following pseudocode:
<script>
require(['other_modulea','kendo-multiselect','kendo-aspnetmvc'], function(){
     // execute deffered controls initialization scripts.
});
</script>

But there is no dependency established between kendo-aspnetmvc and kendo-multiselect (and kendo-combobox - seems to have similar issues). It happens that aspnetmvc executes before kendo-multiselect fulfills it's dependencies, this results in aspmvc not being able to attach to ComboBox and MultiSelect the requestData function. This function is called on deffered initialization script and because aspnetmvc script was loaded prior to kendo-multiselect the function is not available.
It seems that despite the order of modules in requirejs the execution order of the modules is not guaranteed as long as there are no dependencies between them.

Do you have any ideea how this could be solved?

One way could be:
<script>
require(['other_modulea','kendo-multiselect'], function(){
    require(['kendo-aspnetmvc'], function(){
         // execute deffered controls initialization scripts.
     });
});
</script>
but I would really preffer a more generic approach instead on doing this nested require all over the application.

Thanks,
Vasile
Georgi Krustev
Telerik team
 answered on 22 Apr 2013
1 answer
135 views
1. MultiSelect
2. ColorPalette
Dimiter Madjarov
Telerik team
 answered on 19 Apr 2013
10 answers
865 views
Hello!
I want create KEY(first object in my model), before call method Create!
I dont want create KEY, If I edit object, so I can't  write this:
Events(e => e.Edit("getKey()"))

So,probably,I need this:
.ToolBar(commands =>
        {
            commands.Create().HtmlAttributes(new { onclick = "getKey()" });
        })
How I can this do?
Because it's doesn't work :)

Please help!
And thanks for help)

Gusev
Top achievements
Rank 1
 answered on 19 Apr 2013
1 answer
200 views
Hello.

We are using Telerik KendoUI Web for ASP.NET MVC 4 for one of our business applications and were looking to see if we can create something that looks like the screenshot attached using the toolset. 
here is URL from Telerik demo : http://demos.telerik.com/aspnet-ajax/grid/examples/overview/defaultcs.aspx
 
Basically, we are looking to see if we can have a hierarchical DataListView embedded as a child result.
 
Any pointers are very appreciated.
 
Thanks in advance!
Ann
Vladimir Iliev
Telerik team
 answered on 19 Apr 2013
4 answers
151 views
Editable PopUpWindow

I have this:
<script type="text/javascript">
        kendo.culture(//here is my culture);
    </script>
and everything works well,but editable.PopUp window has titile "Edit"
why localization doesnt work?
Gusev
Top achievements
Rank 1
 answered on 19 Apr 2013
1 answer
634 views
Hi,

I want to add a condition for the toolbar template as follow:

 .ToolBar(toolbar =>
            {
                toolbar.Template(
                    @{
                        if(centre.AttributeCenterRels.Count < 6) {
                            @<div class="action text-align-right">
                                <a href="~/AttributCentreRel/Create?CentreId=@centre.Id" class="btn"><i class="icon-plus"></i> Create</a>
                            </div>
                        }
                        else{
                            @<div class="action text-align-right">
                                Vous ne pouvez spécifier que 6 attributs pour un centre.
                            </div>
                        }
                    }
                );
            })

Is this possible?

Regards,
Vladimir Iliev
Telerik team
 answered on 19 Apr 2013
1 answer
310 views
 Hi,

I'm upgrading the kendo to the new one (Spring) and after that, I can't set the selected value for DropDown and Combobox. 
It was ok before when i'm using the old version.
And its happen not only in chrome, but in all browser.

I'm using Visual Studio 2012 (MVC 4), and the new Jquery (1.9.1) and JQuery.Validate.Min.js

following is the code snippet:
@(Html.Kendo().DropDownList()
.Name("color")
.DataTextField("Text")
.DataValueField("Value")
.Value("2")
.BindTo(new List<SelectListItem>() {
new SelectListItem() {
Text = "Black",
Value = "1"
},
new SelectListItem() {
Text = "Orange",
Value = "2"
},
new SelectListItem() {
Text = "Grey",
Value = "3"
}
})
)

It always selects  1 instead of 2?!

Any ideas why?

Thanks :)
Dimiter Madjarov
Telerik team
 answered on 19 Apr 2013
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Security
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
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
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?