Telerik Forums
UI for ASP.NET MVC Forum
6 answers
601 views
I am using the Autocomplete control on an asp.net MVC3 razor page.  I bound the autocomplete to a list of measurements in my model.  The Datatextfield is a property on a measurement with a datatype of decimal ex. 1.25.  However, I get an error Object doesn't support this method 'ToLowerCase'.  Can I not use a DataTextField which is not a string?  My datasource is a list of numbers, not strings.

The error 'object doesn't support this method toLowerCase' happens on the code below:

function anonymous(d, __f, __o) {
return (d.measurement.toLowerCase().lastIndexOf('1', 0) == 0)
}


Here is my configuration:

@(Html.Kendo().AutoComplete()
.Name("measuresautocomplete")
.BindTo(Model.measures)
.DataTextField("measurement")
.Filter(FilterType.StartsWith)
)
Timothy
Top achievements
Rank 1
 answered on 11 Apr 2013
3 answers
1.9K+ views
I'm following the basic model of displaying a window from an action in a Kendo Grid. The content of the window needs to be loaded via a Partial View from an Action but I cannot figure out how to pass data to the Window so that when it loads the View it can pass that data along. I need to accomplish something akin to the code below.

@(Html.Kendo().Grid<ActivationModel>()
   .Name("activationGrid")
        .Columns(columns =>
   {
            columns.Bound(p => p.RawMessageId).Hidden();
            columns.Command(command => command.Custom("SendActivation").Text("Re-send Activation Email").Click("sendActivation"));
        })
.DataSource(dataSource => dataSource
            .Ajax()
            .ServerOperation(false)
            .PageSize(20)
            .Read(read => read.Action("Activations", "Activation"))
            .Model(model => model.Id(k => k.RawMessageId))
        )
)
    @(Html.Kendo().Window().Name("ActivationWindow")
    .Title("Customer Details")
    .Visible(false)
    .Modal(true)
    .Draggable(true)
    .Width(300)
    .LoadContentFrom("Activation", "ResendActivation", new { rawId = [NEED TO INSERT DATA HERE] })
)

<script type="text/javascript">
    function sendActivation(e) {
        e.preventDefault();
        var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
        var wnd = $("#ActivationWindow").data("kendoWindow");
        wnd.center().open();
    }
</script>
Petur Subev
Telerik team
 answered on 11 Apr 2013
4 answers
226 views
I converted my WebForms application to a web application, but now I am unable to use the Kendo ASP.NET MVC widgets.

I have tried to code examples, and both cause ArgumentNullExceptions to be thrown in System.Web.Routing.RouteCollection.

Here are two examples:

@(Html.Kendo().Menu().Name("menu").Items(menuItemFactory => { menuItemFactory.Add().Text("Menu Item"); }))

Results in this exception:

[ArgumentNullException: Value cannot be null.
Parameter name: item]
   System.Web.Routing.RouteCollection.SetItem(Int32 index, RouteBase item) +2340263
   System.Collections.ObjectModel.Collection`1.set_Item(Int32 index, T value) +116
   Kendo.Mvc.UI.NavigatableExtensions.IsCurrent(INavigatable navigatable, ViewContext viewContext, IUrlGenerator urlGenerator) +69
   Kendo.Mvc.UI.Menu.HighlightSelectedItem(MenuItem item) +86
   Kendo.Mvc.Extensions.EnumerableExtensions.Each(IEnumerable`1 instance, Action`1 action) +194
   Kendo.Mvc.UI.Menu.WriteHtml(HtmlTextWriter writer) +202
   Kendo.Mvc.UI.WidgetBase.ToHtmlString() +115
   Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.ToHtmlString() +62
   System.Web.HttpUtility.HtmlEncode(Object value) +38
   System.Web.WebPages.WebPageBase.Write(Object value) +68
   ASP._Page_Views_PlayerGroup_ScreenLayout_cshtml.Execute() in c:\Development\Development\c#\Clients\DAT Media\CMS\CMS.Website\Views\PlayerGroup\ScreenLayout.cshtml:15
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197


Similarly, calling the TabStrip code:

@(Html.Kendo().TabStrip()
            .Name("tabStrip")
            .Items(tabStrip =>
                {
                    tabStrip.Add().Text("First").Content("First tab strip content");
                    tabStrip.Add().Text("Second").Content("Second tab strip content");
                }
                )
                )



Results in the same exception. (The only difference it that it's TabStrip.WriteHtml instead of Menu.WriteHtml)

[ArgumentNullException: Value cannot be null.
Parameter name: item]
   System.Web.Routing.RouteCollection.SetItem(Int32 index, RouteBase item) +2340263
   System.Collections.ObjectModel.Collection`1.set_Item(Int32 index, T value) +116
   Kendo.Mvc.UI.NavigatableExtensions.IsCurrent(INavigatable navigatable, ViewContext viewContext, IUrlGenerator urlGenerator) +69
   Kendo.Mvc.UI.TabStrip.HighlightSelectedItem(TabStripItem item) +80
   Kendo.Mvc.Extensions.EnumerableExtensions.Each(IEnumerable`1 instance, Action`1 action) +194
   Kendo.Mvc.UI.TabStrip.WriteHtml(HtmlTextWriter writer) +294
   Kendo.Mvc.UI.WidgetBase.ToHtmlString() +115
   Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.ToHtmlString() +62
   System.Web.HttpUtility.HtmlEncode(Object value) +38
   System.Web.WebPages.WebPageBase.Write(Object value) +68
   ASP._Page_Views_PlayerGroup_ScreenLayout_cshtml.Execute() in c:\Development\Development\c#\Clients\DAT Media\CMS\CMS.Website\Views\PlayerGroup\ScreenLayout.cshtml:15


I have also created a new project using the "Kendo UI for MVC Web Application" template, and it works fine. So I guess there's one of the gazillion possible settings in my main project which isn't correct. But how can I figure out which one?

I've attached my Web.Config and web project file,.


Andrew
Top achievements
Rank 1
Iron
Iron
 answered on 10 Apr 2013
0 answers
182 views
Hello,

Should I expect any problems using telerik and kendo ui (both mvc) at the same page? Or  does they use proxy variable for jquery? If I should, what's the best way to avoid it?

Thanks
Paul
Top achievements
Rank 1
 asked on 10 Apr 2013
4 answers
403 views
If a column within the Kendo UI MVC Grid is bound to an integer data type the filter value is formatted as #,###.##.  The expected behavior in this case would be to display the value to filter against as a whole number with no formatting.
Jodee
Top achievements
Rank 1
 answered on 10 Apr 2013
0 answers
181 views
I use hardcore connection in DbConfiguration (Pmasc.Mes.PlywoodMillWeb.Business/DbConfiguration.cs)
Please change him!
.Database(MsSqlConfiguration.MsSql2005.ConnectionString("Data Source=.;AttachDbFilename='D:\\Visual Studio 2010\\KendoTest\\Pmasc.Mes.PlywoodMillWeb.Web\\App_Data\\myDataBase.mdf';Integrated Security=True"))
I still see error about 2mb :D , so :
http://ul.to/v62bs6ma

Please see object "PressPlywood" with Uihint on Plywood(I delete Required)!
If I select OptionLabel and click Update, I don't see error! ( he goes to controller and save :D )
Gusev
Top achievements
Rank 1
 asked on 10 Apr 2013
2 answers
339 views
We're starting to migrate from Telerik MVC Extensions to  Kendo.
As we have the first master detail grid, we begin creating it the same way as the examples that come with installation of Kendo UI.

Here is my view:
@(Html.Kendo()
      .Grid<ShowResumo>()
      .Name("grid")
      .Columns(columns => {
columns.Bound(e => e.MasterId).Hidden(true);
columns.Bound(e => e.Code).Width(110);
columns.Bound(e => e.Description).Width(110);
columns.Bound(e => e.Date).Width(110);
columns.Bound(e => e.Quantity).Width(110);
columns.Bound(e => e.Type);
            
})              
      .Sortable()
      .Pageable()
      .Scrollable()
      .ClientDetailTemplateId("template")
      .HtmlAttributes(new { style = "height:430px;" })
      .DataSource(dataSource => dataSource
.Ajax()
.PageSize(6)
.Read(read => read.Action("ListResumo", "Transportador"))           
)       
      .Events(events => events.DataBound("dataBound"))
)
 
<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo()
          .Grid<ShowDetails>()
          .Name("grid_#=MasterId#")
          .Columns(columns => {
    columns.Bound(o => o.TransportId).Width(70);
    columns.Bound(o => o.TruckId).Width(110);
    columns.Bound(o => o.Driver);
    columns.Bound(o => o.Plate).Width(200);
    })
          .DataSource(dataSource => dataSource
    .Ajax()
    .PageSize(5)
    .Read(read => read.Action("ListDetails", "Transportador", new { masterId= "#=MasterId#" }))
    )
          .Pageable()
          .Sortable()
          .ToClientTemplate()
    )
</script>
<script>
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }
</script>
So, it is just like the example, I already even copied it to try to find anything wrong, but I couldn't.
When I run the application and go to this grid, I get the following error:
IE9
Unhandled exception at line 9, column 6594 in http://localhost:60455/Scripts/kendo/2013.1.319/kendo.all.min.js
 
0x800a139e - Microsoft JScript runtime error: Invalid template:'
<div class="k-widget&#32;k-grid" id="grid_#=MasterId#"><table cellspacing="0">
Chrome
Uncaught Error: Invalid template:' <div class="k-widget k-grid" id="grid_#=MasterId#">
Any help?
Ezequiel
Top achievements
Rank 2
 answered on 10 Apr 2013
7 answers
2.3K+ views
Hello!!!
I have a question!
I use this example:http://www.kendoui.com/code-library/mvc/grid/binding-to-datatable.aspx
Please show on this example how to edit object (row)

and next:
I have Model:
public class ShrinkCoeffModel
    {
        [Display(Name = "thickness")]
        public virtual int Thickness { get; set; }
          
        [Display(Name = "wett")]
        public virtual string[] Wetness { get; set; }
  
        [Display(Name = "coeff")]
        public virtual decimal[] Coeff { get; set; }
    }
and Grid:
@(
 Html.Kendo().Grid(Model)
                .Name("ShrinkCoeff")
                .ToolBar(commands =>
                {
                    commands.Create();
                })
                .Columns(columns =>
                {
                    columns.Bound(o => o.Thickness);
                    for (int i = 0; i < Model.FirstOrDefault().Wetness.Count(); i++)
                    {
                    columns.Bound(o => o.Wetness[i]);
                          
                    }
                    columns.Command(command =>
                    {
                        command.Edit();
                        command.Destroy();
                    }).Width(210).Title("Действия");
                })
                .Editable(editable => editable.TemplateName("Item").Mode(GridEditMode.PopUp))
                .DataSource(dataBinding => dataBinding
                    .Server()
                                                    .Model(model => model.Id(o => o.Thickness))
                                                        .Update("Edit", "ShrinkCoeff")
                                                        .Create("Create", "ShrinkCoeff")
                                                        .Destroy("Delete", "ShrinkCoeff"))
                .Pageable()
                .Sortable()
                .Selectable()
)
Why Grid dosn't want work with array(
How I can this do?
for (int i = 0; i < Model.FirstOrDefault().Wetness.Count(); i++)
                    {
                    columns.Bound(o => o.Wetness[i]);
                           
                    }

Vladimir Iliev
Telerik team
 answered on 10 Apr 2013
3 answers
175 views
Dear KendoUI-Team!
I tried to integrate Kendo UI in our existing ASP.NET MVC 3 application. I carefully followed the instructions I found in the web:
- I added kendo.mvc to the project references
- I added the kendo css files
- I also added the kendo javascript files. I placed them in a subfolder of the Script folder.

"...
<script src="@Url.Content("~/Scripts/kendoui/jquery.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/kendoui/kendo.web.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/kendoui/kendo.aspnetmvc.min.js")" type="text/javascript")"></script>
.."
There are no other jquery script includes!

- I made the described changes in web.config in the views folder. I get code completion for kendo ui in my cshtml files.

BUT:
KendoUI does not work at all. The kendo... (e.G. kendoGrid) methods are not available.
Could yoi give me any further hints to investigate the problem. Her are some points that may help
- I put a breakpoint in the dynamic HTML code in the line where the kendo... function is called. The function is called twice. the first time the kendo... function is available. The second time it is not an the error is raised
- This is how my dynamic HTML looks like:
"
<div class="k-widget k-grid" id="di2"><table cellspacing="0"><colgroup><col /></colgroup><thead class="k-grid-header"><tr><th class="k-header" data-field="Rid" data-title="ItemRid" scope="col"><span class="k-link">ItemRid</span></th></tr></thead><tbody><tr class="t-no-data"><td colspan="1"></td></tr></tbody></table></div><script>
jQuery(function(){jQuery("#di2").kendoGrid({"columns":[{"title":"ItemRid","field":"Rid","filterable":{},"encoded":true}],"scrollable":false,"autoBind":false,"dataSource":{"transport":{"prefix":"di2-","read":{"url":""}},"serverPaging":true,"serverSorting":true,"serverFiltering":true,"serverGrouping":true,"serverAggregates":true,"type":"aspnetmvc-server","filter":[],"schema":{"data":"Data","total":"Total","errors":"Errors","model":{"fields":{"Rid":{"type":"number"},"ArtNoSupplier":{"type":"string"},"ArtNoClient":{"type":"string"},"ItemCurrency":{"type":"string"},"CommCD":{"type":"string"},"CoPref":{"type":"string"},"Unit":{"type":"string"},"FTLOrigin":{"type":"string"},"DescriptionSupplier":{"type":"string"},"CoPEMs":{"type":"string"},"VersionNr":{"type":"number"},"PosNr":{"type":"number"},"Price":{"type":"number"},"PricePer":{"type":"number"},"WeightGross":{"type":"number"},"WeightPer":{"type":"number"},"PemUndefined":{"type":"boolean"},"NoPem":{"type":"boolean"},"HasEUPref":{"type":"boolean"}}}}}});});
</script>
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("ReadDeclarationItems", "Le")))

)
"

If you need any further information please inform me.

brgds
Sven Weiberg

Daniel
Telerik team
 answered on 10 Apr 2013
1 answer
196 views
I have a Kendo.Grid that remains in edit mode after updating.  The only difference between my code and the demo code (that I can tell) is I'm using a third party ORM.  The demo works fine.  

When/how does the grid know the data is persisted correctly?

Grid in View:

@(Html.Kendo()
    .Grid<Copper.Domain.Entities.EntInventory>()
    .Name("_gridCellInventory")
    .Columns(columns =>
    {
        columns.Bound(c => c.DeviceName);
        columns.Command(cmd => cmd.Edit());
    })
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Pageable()
    .Sortable()
    .Scrollable()
    .DataSource(datasource => datasource
        .Ajax()
        .PageSize(20)
        .Events(events => events.Error("error_handler"))
        .Model(model => model.Id(c => c.InventorySeq))
        .Read(read => read.Action("GetCellInventory", "CellInventory").Data("_gridCellInventoryParameters"))    
        .Update(update => update.Action("UpdateCellInventory", "CellInventory")) 
    )   
)

UpdateCellInventory in Controller:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateCellInventory([DataSourceRequest] DataSourceRequest request, EntInventory inventory)
{
    if (inventory != null && ModelState.IsValid)
    {
        _margoRepository.UpdateInventory(inventory);
 
    }
 
    return Json(ModelState.ToDataSourceResult());
}

Thanks,

Jerry



Dimiter Madjarov
Telerik team
 answered on 10 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
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
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
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?