Telerik Forums
UI for ASP.NET MVC Forum
2 answers
1.5K+ views
Hello -

I had to change my Model to include two lists so i can bind it to two sets.

Now my model looks like:
public class PaymentsViewModel
{
    public List<CorporateViewModel> Corporations { get; set; }
    public List<PaymentViewModel> Payments { get; set; }
}
My controller looks like
public ActionResult Payments_Read([DataSourceRequest]DataSourceRequest request)
{
    //get corps
    //get payments
 
    PaymentsViewModel returnObj = new PaymentsViewModel();
    returnObj.Corporations = corps;
    returnObj.Payments = payments;
 
    DataSourceResult result = returnObj.ToDataSourceResult(request); <== returns error
 
    return Json(result);
}

Errors:
  • cannot convert from 'PaymentsViewModel' to 'System.Data.DataTable' 
  • 'PaymentsViewModel' does not contain a definition for 'ToDataSourceResult' and the best extension method overload 'Kendo.Mvc.Extensions.QueryableExtensions.ToDataSourceResult(System.Data.DataTable, Kendo.Mvc.UI.DataSourceRequest)' has some invalid arguments 
Any  ideas how to go about it? Should I change my ViewModel? Or have different approach?

Thanks.
Christos
Top achievements
Rank 1
 answered on 16 Oct 2013
1 answer
136 views
Hello, I'm new with MVC & Kendo and follow some demo videos (http://www.youtube.com/watch?v=1CPediqnIt8) and tried "do-it yourself".

The Controller:

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace KendoUIMvcApplication3.Controllers
{
    public class FoldersController : Controller
    {
        private FotosACSEntities db = new FotosACSEntities();

        //
        // GET: /Folders/

        public ActionResult Index()
        {
            var folders = db.Folders.Select(f => new
            {
                ID = f.ID,
                Nome = f.Nome
            });

            return Json(folders, "text/html", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet); 
...

The View:

@model IEnumerable<KendoUIMvcApplication3.Folders>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>
<br />

@Html.Kendo().DropDownList().Name("cbFolders").DataSource(dataSource => dataSource.Read(read => read
            .Action("Index", "Folders"))).DataTextField("Nome").DataValueField("ID");

...

And the Result: (IE and Chrome)

[{"ID":1,"Nome":"\\CD 06_Fotos Pessoais"},{"ID":2,"Nome":"\\Fotos Pessoais\\Album 002\\JPG"},{"ID":3,"Nome":"\\Fotos Pessoais\\Album 003\\JPG"},{"ID":4,"Nome":"\\Fotos Pessoais\\Album 004\\JPG"},{"ID":5,"Nome":"\\Fotos Pessoais\\Album 007\\JPG"},{"ID":6,"Nome":"\\Fotos Pessoais\\Album 008\\JPG"},{"ID":7,"Nome":"\\Fotos Pessoais\\Album 009\\JPG"},{"ID":8,"Nome":"\\Fotos Pessoais\\Album 010\\JPG"},{"ID":9,"Nome":"\\Fotos Pessoais\\Album 011\\JPG"},{"ID":10,"Nome":"\\Fotos Pessoais\\Album 013\\JPG"},{"ID":11,"Nome":"\\Fotos Pessoais\\Album 014\\JPG"},{"ID":12,"Nome":"\\Fotos Pessoais\\Album 017\\JPG"},{"ID":13,"Nome":"\\Fotos PM\\Album 001"},{"ID":14,"Nome":"\\Fotos PM\\Album 002"},...

What's happening?

Regards,

Rui
Daniel
Telerik team
 answered on 16 Oct 2013
1 answer
102 views
This code is needed for binding to a normal Linq
return Json(model.ToDataSourceResult(request));
But because I need to bind to a XRM 2011 so have few limits I want to customize the query
How can I do it?
Rosen
Telerik team
 answered on 16 Oct 2013
1 answer
91 views
Hi,

I am new to kendo, I am using kendo menu component, the data for menu comes on a ajax call. I want to open menu at runtime on some user interaction other than clicking menu, I found open method in API, but what value should I pass as argument. If I need to pass Id of an element how can I get Id of elements that were created at run time with ajax call.

It's very urgent for me, please can any give solution?

Thanks,
Gopi.
 
Ignacio
Top achievements
Rank 1
 answered on 15 Oct 2013
3 answers
3.6K+ views
I recently added Grid Column Menus to my grid, primarily to give the user the ability to hide/show columns.
.ColumnMenu(menu => menu.Columns(true).Sortable(false))

I want some columns hidden by default, and the user to have the ability to display them if needed. So, using the MVC helpers, I set Visible(false) like so:
column.Bound(c => c.Submitter).Title("Submitter").Visible(false);
However, to my surprise, columns hidden in this manner do not show up in the column menu. It's like they don't exist.

I was able to get it working correctly by loading all columns as normal and then hiding certain ones via JavaScript:

$(document).ready(function () {
    var grid = $('#issueGrid').data('kendoGrid');
    grid.hideColumn('Submitter');

But I have 2 issues with this:
A) There is some graphical stutter as the columns are noticably loaded and then hidden.
B) I shouldn't have to do this. Setting a column as .Visible(false) should still have that column appear in the Menus.

Is this a bug? Why does setting a column as .Visible(false) cause it to act like it does not exist, in regards to the Column Menu? I wish I didn't have to write 10+ extra lines of script to do this.

Thanks.
Dave
Top achievements
Rank 1
 answered on 15 Oct 2013
2 answers
901 views
I would like to get the text for a selected menu item from JavaScript/jQuery in a clean way. I would rather not use jQuery matching for specific classes if possible, I'm hoping for something like:

$("#myMenu").getSelectedItemText()

Alternatively, I guess I could populate a variable during a Select event handler or something. 

Any suggestions?  Thanks!
Ian
Top achievements
Rank 1
 answered on 14 Oct 2013
1 answer
126 views
Change skin to metro

Select dropdown here: http://demos.kendoui.com/web/combobox/serverfiltering.html

Notice how the ajax loading icon is the same color as background
Dimo
Telerik team
 answered on 14 Oct 2013
2 answers
105 views
Borwser : Chrome
Version : version 2013.2.918

Chrome:CHROME IMG
IE11:IE11 IMG


Plz Help fix it
Chia Hao
Top achievements
Rank 1
 answered on 14 Oct 2013
1 answer
619 views
I've got a menu bound to a model but I can't seem to set the LinkHtmlAttributes.

It looks like this:


@(Html.Kendo().Menu()
    .Name("menu")
    .BindTo(Model, mappings =>
        {
            mappings.For<MenuModel>(binding => binding
                .ItemDataBound((items, menu) =>
                    {
                        items.Text = menu.Text;
//I want to set the link attributes, but this isn't working
items.LinkHtmlAttributes = new { foo = "bar" };
                    })
)
Ignacio
Top achievements
Rank 1
 answered on 11 Oct 2013
3 answers
818 views
Hi all! 
So i have Upload on my page:

@(Html.Kendo().Upload()
    .Name("docUpload")
    .Multiple(false)
    .ShowFileList(false)
    .Events(e => e.Upload("onUpload").Success("onDocUploaded"))
    .Async(a => a
        .Save("DocUpload", "Documents")
        .AutoUpload(true)
    )
)
this one works fine and all events - onUpload and onDocUploaded - firing as expected.

But if i want to add custom messages:

@(Html.Kendo().Upload()
    .Name("docUpload")
    .Messages(x=>x.Select("Select document..."))
    .Multiple(false)
    .ShowFileList(false)
    .Events(e => e.Upload("onUpload").Success("onDocUploaded"))
    .Async(a => a
        .Save("DocUpload", "Documents")
        .AutoUpload(true)
    )
)
it will break events, and no events (except onComplete) are called in my JavaScript.
I have tested it on Chrome (last version) and IE 9. My KendoUI version is 2013.2.918.
Is there any workarounds?
Dimiter Madjarov
Telerik team
 answered on 11 Oct 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
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?