Telerik Forums
UI for ASP.NET MVC Forum
3 answers
145 views
Hi,

This question and example actually applies to the Grid but since it is about the DataSource I'm posting it in the General Area.

As you can see below I'm using a read action for my Ajax request. And also using the Data method to provide the action with Data.

When I only provide string or integer types in the return function (AdditionalData) everything is fine. But when I want to use a Date (i.e. StartDate, EndDate), the properties StartDate and EndDate are not passed to the Action Controller and the Action cannot be found (because the parameters do not match, I think).

Is there a simple way to pass a Date object to your Action Controller or not to use the .Read(.. method but a jQuery ajax request?

Kind regards,

Lennart

Grid Definition:
@(Html.Kendo().Grid(Model) // Bind the grid to the Model property of the view
      .Name("Grid")
      .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("HistoryDowntimes_Read", "TimeRegistration").Data("AdditionalData")))
      .Columns(columns =>
      {
          columns.Bound(p => p.TimeEventID);
  ....

Data Return Function:
function AdditionalData() {
        return {
            LocationID: 8,
            StartDate: new Date(2012, 1, 1, 11, 42, 30, 477),
            EndDate: new Date(2013, 1, 1, 11, 42, 30, 477)
        };
    }
==> Fixed LocationID and Date is for Development purposes only.
kunapa
Top achievements
Rank 1
 answered on 08 Feb 2013
3 answers
296 views
Hi. I'm attempting to bind the attached data example to a Stacked Bar Chart and not having much luck using the example here:

http://demos.kendoui.com/dataviz/bar-charts/grouped-stacked-bar.html

The goal is to have Months on the X-axis and Product totals per month, each product stacked on the Y-axis. The example provided only show configuration for building using static data is a particular format. Is it possible to use the data sample attached without reorganizing?

Thanks.
Dimiter Madjarov
Telerik team
 answered on 08 Feb 2013
1 answer
320 views
Hi,

I know how to specify aggregates when using a DataSource to populate the grid.

But how do I define aggregates when I'm populating the Grid using BindTo?

I want a Sum row at the bottom of this Grid:
@(Html.Kendo().Grid<Models.AgentLeaderData>()
        .Name("AgentLeaderData")
        .Columns(col =>
        {
            col.Bound(p => p.AgentName);
            col.Bound(p => p.Revenue).HtmlAttributes(new { style = "text-align:right" });
        })
         
        .BindTo(Model.AgentLeaderData)
)
Daniel
Telerik team
 answered on 08 Feb 2013
2 answers
264 views
I am successfully populating my treeview via the BindTo method.  As you can see below, I bind to a single entity of type "Organisation" which has collection of child organisations called "ChildOrganisations".   You can also see that I do some conditional formating of styles depending of the value of property "organisation.organisation_type_id"
@(Html.Kendo().TreeView()
    .Name("OrganisationTreeview")
    .ExpandAll(true)
    .BindTo(Model, mapping => mapping
        .For<Organisation>(binding => binding
            .Children(organisation => organisation.ChildOrganisations)
            .ItemDataBound((item, organisation) =>
            {
                item.Text = organisation.organisation_unit_name;
                item.Id = organisation.organisation_unit_id.ToString();
 
                if (organisation.organisation_type_id == 1)
                {
                    item.HtmlAttributes.Add("style", "font-size: 18px;font-weight:bold;");
                }
                else if (organisation.organisation_type_id == 3)
                {
                    item.HtmlAttributes.Add("style", "font-size: 14px;font-weight:bold");
                }
                else if (organisation.organisation_type_id == 2)
                {
                    item.HtmlAttributes.Add("style", "font-size: 12px;font-weight:normal");
                }
            })))
)


As I bind the children nodes via the item.Text and item.Id properties, I also want to be able to add an image next to the node text.  The image will be different depending on the value of a organisation.enabled.  How can I do that?
James Vassallo
Top achievements
Rank 2
 answered on 08 Feb 2013
1 answer
361 views
Is it possible to make a column header to be dentered while the rest follows the default setting?
Iliana Dyankova
Telerik team
 answered on 07 Feb 2013
3 answers
1.6K+ views
I cant seem to get window to open, I get error
 Unable to get property 'open' of undefined or null reference

$("*[data-add-team]").click(function () {
    var win = $("#teamWindow")
    win.show().data("kendoWindow").open().center().toFront();
})
    <div data-menu-item="teams">
        @code
            Dim TeamCreateWindows As Kendo.Mvc.UI.Window = Html.Kendo.Window() _
                                                               .Name("teamWindow") _
                                                                   .Title("Create Team") _
                                                                   .Actions(Sub(actions)
                                                                                    actions.Custom("custom")
                                                                                    actions.Minimize()
                                                                                    actions.Maximize()
                                                                                    actions.Close()
                                                                            End Sub) _
                                                                        .LoadContentFrom("create", "team", New With {.area = "contractor"}).Animation(True) _
            .Content(Sub()
    @<text>
    Loading.......
    </text>
                     End Sub) _
        .Draggable().Resizable().Width(500)
     
    TeamCreateWindows.Render()
End Code
            @Html.Button("addTeam", "Add Team", BO.Enumerators.ButtonType.Button, BO.Enumerators.ButtonStyle.LoLight, New With {.data_add_team = True})
 
        @Html.Partial("_Teams", Model.Contractor)      
    </div>

Alan Mosley
Top achievements
Rank 1
 answered on 06 Feb 2013
1 answer
152 views
Is there an MVC wrapper for mobile in the works?  If so what would be a rough estimate of release date?
Sebastian
Telerik team
 answered on 06 Feb 2013
2 answers
174 views
I've got a chart, which I want to be able to dynamically set the theme for - based upon a value set in a ViewBag variable.

I can do this if the chart is defined in JavaScript, however I can't seem to set it when the chart is defined using the helper.

i.e.:-
@(Html.Kendo().Chart<CMS_2013.Models.Temp_Data_Summary>()
      .Name("Chart")
      .Legend(false)
      .Title("Data in Temporary Pricing Table")
      .DataSource(dataSource => dataSource
          .Read(read => read.Action("GetSummaryChartData", "Pricing"))          
      )
      .Series(series => {
          series.Column(d => d.Records).Tooltip(true) ;
          
      })
      .CategoryAxis(axis => axis
          .Categories(model => model.Class)
      )
       
      .HtmlAttributes(new { style = "width:350px; height:250px;"})
)
If I do:-

.Theme(ViewBag.SelectedTheme) - the page returns an error.  How can I do this?
AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 06 Feb 2013
4 answers
221 views
if i have this code
@(Html.Kendo().Grid(Model)    
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.emplmark).Groupable(false);
        columns.Bound(p => p.firstname);
        columns.Bound(p => p.lastname);
        columns.Bound(p => p.location);
        columns.Bound(p => p.county);
    })
    .Groupable()
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("GetWork", "Company"))
    )
)

The source return around 2000 records,but after i press next page(page 2),the data disapear.why?it isn't enough to put Pageable,to work the paging?
Daniel
Top achievements
Rank 1
 answered on 06 Feb 2013
3 answers
987 views
I have a question about filtering on the Kendo Grid.  I have looked all over the API docs, these forums, and SO and haven't come up with anything, so I figured I'd ask here.

Is there a straightforward way to set the filtering type to a different type other than the underlying type of the bound column?  

E.g.
I have a column called "ActivityID" bound to an int property in my ViewModel.  In the ClientTemplate of the bound column, I'm showing a property from my ViewModel called "ActivityNumber", which is a string.  When the user hits the filter drop down in the column header, I want them to be able to filter based on the string operators I have set up in the grid, not the number operators.

Does anyone know if there a straightforward way in the Kendo().Grid() configuration to achieve this?  I'm sure there's  a way to do it on the client side, but I was hoping that I was missing something really obvious before going down that path.
Dimiter Madjarov
Telerik team
 answered on 06 Feb 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?