Telerik Forums
UI for ASP.NET MVC Forum
1 answer
291 views
Not sure why there is no data being pulled into the chart.
I used fiddler to test the Json call and verified that the data is there
However, when running these code through the debugger, the break point never stop at the DrillDownChart_Read ActionResult.


Controller:
[HttpGet]
public ActionResult DrillDownChart_Read()
{
List<IDrillDownChart> myResultList = new List<IDrillDownChart>();
List<int> myIntList = new List<int>();
myIntList.Add(1);
myIntList.Add(2);
myResultList.Add(new DrillDownChartCategoryWithData("x", 20, 25, 1, "webvstf", "Engineering Systems", myIntList));
myResultList.Add(new DrillDownChartCategoryWithData("y", 30, 25, 1, "webvstf", "Engineering Systems", myIntList));

return Json(myResultList, JsonRequestBehavior.AllowGet);
}


View:
@(Html.Kendo().Chart<IDrillDownChart>()
.Name("chart")
.Title("Drill Down Chart")
.Legend(legend => legend
.Position(ChartLegendPosition.Top)
)
.DataSource(dataSource => dataSource
.Read(read => read.Action("DrillDownChart_Read", "ProjectReports"))
)
.SeriesDefaults(seriesDefaults =>
seriesDefaults.Bar().Stack(true)
)
.Series(series => {
series.Bar(d => d.PercentComplete)
.Name("Percent Complete")
.Color("#A7A7A7");
 })
.CategoryAxis(axis => axis
.Categories(model => model.DisplayTitle)
)
 
)
Petur Subev
Telerik team
 answered on 08 Nov 2013
7 answers
362 views
Hi: I have the following problem with my Kendo dropdownlist:
   In the model I pass to my view I have a list of Users, that I want to link to a dropdownlist called UsuariosDrpDwn
 and show it in a certain column("Usuario") of every row of my grid ( marked bold).
    
   I program the dropdownlist and it populates allright with the users, but when I link it to one of my grid's columns("Usuario"), the problem is it's values spread along the rows of the grid. Let's say my users are John, Martha, Grant, Michael. What happens is, John appears in the column "Usuario" of the first row, Martha in the column Usuario of the second row, Grant in the column Usuario of the third row, and Michael in the fourth.
      
   These is the code for the dropdownlist:

@(Html.Kendo().DropDownListFor(d=>d)
            .Name("UsuariosDrpDwn").HtmlAttributes(new { @style = "font-size:12px" })
            .DataTextField("NombreUsuario")
            .DataValueField("IdUsuario")
            .BindTo(Model)
            )
And this the code for my grid, I mark bold the column that is bounded to the dropdownlist:
        @(Html.Kendo().Grid(Model)
        .Name("Grid")
         .Columns(columns=>
          {
            columns.Bound(d => d.BorradoLogico).Title("Borrado logico");
            columns.Bound(d => d.FTick).Title("Ftick");
            columns.Bound(d => d.NombreUsuario).Title("Usuario").EditorTemplateName("UsersDrpDwn");
           @columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
          })
   I attach my view.
Atanas Korchev
Telerik team
 answered on 08 Nov 2013
1 answer
344 views

I have a hierarchical grid where the child grid elements can be updated but the parent cannot but a calculated value needs to be updated via javascript from the refreshed child. When I edit the child grid elements all is well. If I create a new row the calculated value is updated correctly but the grid doesn't refresh and show the new row. Manually refreshing the grid makes the row appear.

Grid:

@(Html.Kendo().Grid<TimeAndAttendance.Models.DaysActivityViewModel>()
      .Name("grid_#=SelectedAssociateID#") // make sure the Name is unuque
      .Columns(columns =>
      {
          columns.Bound(ta => ta.BeginPeriod).Title("Alloc Period")
                                                .Format("{0:MM-dd-yyyy}");
          columns.Bound(ta => ta.OperatingUnit).Title("Operating Unit")
                                                .ClientTemplate("\\#: OperatingUnit.Description \\#")
                                                .EditorTemplateName("OperatingUnitEditor")
                                                .Visible(Model.TAColumns.OperatingUnitVisible);
          columns.Bound(ta => ta.Position).Title("Position")
                                                .ClientTemplate("\\#: Position.Description \\#")
                                                .EditorTemplateName("PositionEditor")
                                                .Visible(Model.TAColumns.PositionVisible);
          columns.Bound(ta => ta.Department).Title("Department")
                                                .ClientTemplate("\\#: Department.Description \\#")
                                                .EditorTemplateName("DepartmentEditor")
                                                .Visible(Model.TAColumns.DepartmentVisible);
          columns.Bound(ta => ta.Shift).Title("Shift")
                                                .ClientTemplate("\\#: Shift.Description \\#")
                                                .EditorTemplateName("ShiftEditor")
                                                .Visible(Model.TAColumns.ShiftVisible);
          columns.Bound(ta => ta.Paycode).Title("Paycode")
                                                .ClientTemplate("\\#: Paycode.Description \\#")
                                                .EditorTemplateName("PaycodeEditor")
                                                .Visible(Model.TAColumns.PaycodeVisible);
          columns.Bound(ta => ta.Tier).Title("Tier")
                                                .ClientTemplate("\\#: Tier.Description \\#")
                                                .EditorTemplateName("TierEditor")
                                                .Visible(Model.TAColumns.TierVisible);
          columns.Bound(ta => ta.Level).Title("Level")
                                                .ClientTemplate("\\#: Level.Description \\#")
                                                .EditorTemplateName("LevelEditor")
                                                .Visible(Model.TAColumns.LevelVisible);
          columns.Bound(ta => ta.Wage).Title("Wage")
                                                .ClientTemplate("\\#: Wage.Description \\# <input type='button' style='float:right;color:Red' onclick='override(this, \\#:ID\\#);' value='Override'/>")
                                                .Visible(Model.TAColumns.WageVisible);
          columns.Bound(ta => ta.Hours).Format("{0:n2}").EditorTemplateName("Number");
          columns.Bound(ta => ta.Notes);
          columns.Bound(ta => ta.Status).ClientTemplate("\\#: Status.Description \\#");
          columns.Command(command => { command.Edit().Text(""); command.Destroy().Text(""); }).Visible(Model.TAColumns.ShowEditDelete);
          columns.Command(command =>
          {
              command.Custom("reject").Text("Reject").Click("rejectPrompt");
              command.Edit().Text("");
          })
                .Visible(Model.TAColumns.ShowWageReject);
      })
      .DataSource(dataSource =>
          dataSource.Ajax()
          .Read(read => read.Action("TimeAllocations", "TeamTimeEntry", new { assocID = "#=SelectedAssociateID#" }).Data("getReadParameters"))
          .Update(update => update.Action("Edit", "TeamTimeEntry", new { assocID = "#=SelectedAssociateID#" }))
          .Destroy(destroy => destroy.Action("Delete", "TeamTimeEntry", new { assocID = "#=SelectedAssociateID#" }))
          .Create(create => create.Action("Create", "TeamTimeEntry", new { assocID = "#=SelectedAssociateID#" }).Data("getReadParameters"))
          .Model(model =>
          {
              model.Id(ia => ia.ID);
              model.Field(field => field.BeginPeriod).Editable(false);
              model.Field(field => field.Status).DefaultValue(Model.Statuses.FirstOrDefault()).Editable(false);
              model.Field(field => field.OperatingUnit).DefaultValue(Model.OperatingUnits.FirstOrDefault()).Editable(Model.TAColumns.OperatingUnitVisible);
              model.Field(field => field.Shift).DefaultValue(Model.Shifts.FirstOrDefault()).Editable(Model.TAColumns.ShiftVisible);
              model.Field(field => field.Department).DefaultValue(Model.Departments.FirstOrDefault()).Editable(Model.TAColumns.DepartmentVisible);
              model.Field(field => field.Paycode).DefaultValue(Model.Paycodes.FirstOrDefault()).Editable(Model.TAColumns.PaycodeVisible);
              model.Field(field => field.Position).DefaultValue(Model.Positions.FirstOrDefault()).Editable(Model.TAColumns.PositionVisible);
              model.Field(field => field.Tier).DefaultValue(Model.Tiers.FirstOrDefault()).Editable(Model.TAColumns.TierVisible);
              model.Field(field => field.Level).DefaultValue(Model.Levels.FirstOrDefault()).Editable(Model.TAColumns.LevelVisible);
              model.Field(field => field.Wage).DefaultValue(Model.Wages.FirstOrDefault()).Editable(false);
          })
      )
      .ToolBar(toolbar =>
                toolbar.Create().Text("New Time Allocation")
                )
      .Events(events =>
                events.Save("save")
                    .Remove("remove")
                    .DataBound("childDataBound"))
      .ToClientTemplate())

JavaScript:

function updateVarianceDisplay(e) {
    var grid = $('#TimeAllocations').data('kendoGrid');
    var row = $(e.sender.element[0]).parent().parent().parent().parent().prev();
    var dataItem = grid.dataItem(row);
    if (dataItem != null) {
        var childGrid = $('#grid_' + dataItem.SelectedAssociateID).data('kendoGrid');
        var totalHoursAssigned = 0;
        var variance = 0;
        $(childGrid._data).each(function (index, value) {
            totalHoursAssigned += value.Hours;
        });
        dataItem.set("TotalHoursAssigned", totalHoursAssigned);
        variance = dataItem.PeriodHoursWorked - totalHoursAssigned;
 
        var varianceMessageHTML = printVariance(variance);
        var varianceHTML = colorCodeUnassigned(variance);
 
        $('[id^="fntUnassigned:' + dataItem.SelectedAssociateID + '"]').html(varianceHTML);
        $('[id^="fntVariance:' + dataItem.SelectedAssociateID + '"]').html(varianceMessageHTML);
 
        dataItem.set("UnassignedHours", variance);
    }
}
 
function save(e) {
    updateVarianceDisplay(e);
}
 
function remove(e) {
    updateVarianceDisplay(e);
}

Controller:

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
[AcceptVerbs(HttpVerbs.Post)]
public JsonResult Create([DataSourceRequest]DataSourceRequest request, int assocID, DaysActivityViewModel viewModel, string SelectedFacilityID, string begingPeriod)
{
    TimeAllocation ta = new TimeAllocation()
    {
        ModifiedBy = HttpContext.User.Identity.Name,
        AssociateID = assocID,
        Created = DateTime.Now,
        DepartmentID = (short?)viewModel.Department.ID,
        FacilityAccountID = (short?)viewModel.OperatingUnit.ID,
        ShiftID = viewModel.Shift.ID,
        PositionID = (short)viewModel.Position.ID,
        Hours = (decimal)viewModel.Hours,
        PayCodeID = (short)viewModel.Paycode.ID,
        Period = viewModel.BeginPeriod, //RGM 09-05-13 Does the TimeAllocation
        StatusID = 1
    };
    db.TimeAllocations.AddObject(ta);
    db.SaveChanges();
 
    viewModel.FacilityAccount = db.FacilityAccounts.Where(f => f.ID == ta.FacilityAccountID).FirstOrDefault().OperatingUnit;
 
    if (!string.IsNullOrEmpty(viewModel.Notes))
    {
        Note n = new Note() { Note1 = viewModel.Notes, CreatedBy = User.Identity.Name, Created = DateTime.Now };
        db.Notes.AddObject(n);
        db.SaveChanges();
 
        TimeAllocationNote tan = new TimeAllocationNote()
        {
            NoteID = n.ID,
            //NoteTypeID = db.NoteTypes.Where(nt => nt.Description == "Time Allocation Note").Single().ID,
            TimeAllocationID = ta.ID
        };
        db.TimeAllocationNotes.AddObject(tan);
        db.SaveChanges();
    }
    viewModel.ID = ta.ID;
    return this.Json(new[] { viewModel }.ToDataSourceResult(request));
}

Also, the remove function does the opposite. The row is removed but the data in the JavaScript still contains the old row so the calculation is off. The grid and JavaScript for this are above, the controlled code is below.

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
[AcceptVerbs(HttpVerbs.Post)]
public JsonResult Delete([DataSourceRequest]DataSourceRequest request, int assocID, DaysActivityViewModel viewModel)
{
    if (db.TimeAllocations.Where(ta => ta.ID == viewModel.ID).FirstOrDefault().TimeAllocationNotes.FirstOrDefault() != null)
    {
        long noteID = db.TimeAllocations.Where(ta => ta.ID == viewModel.ID).FirstOrDefault().TimeAllocationNotes.FirstOrDefault().NoteID;
        long tanID = db.TimeAllocations.Where(ta => ta.ID == viewModel.ID).FirstOrDefault().TimeAllocationNotes.FirstOrDefault().ID;
        db.Notes.DeleteObject(db.Notes.Where(n => n.ID == noteID).FirstOrDefault());
        db.TimeAllocationNotes.DeleteObject(db.TimeAllocationNotes.Where(tan => tan.ID == tanID).FirstOrDefault());
    }
    db.TimeAllocations.DeleteObject(db.TimeAllocations.FirstOrDefault(t => t.ID == viewModel.ID));
    db.SaveChanges();
 
    viewModel = new DaysActivityViewModel();
 
    return Json(new[] { viewModel }.ToDataSourceResult(request, ModelState));
}

Thanks for any pointers as to what I am doing wrong.

Mike
Top achievements
Rank 1
 answered on 07 Nov 2013
3 answers
2.2K+ views
I am trying to find a property of the DropDownList that will set the actual height of the widget itself. I found the height property that appears to set the height of the dropdown portion of the control but I want to adjust how tall the widget itself is. Is this something that can be set?
Iliana Dyankova
Telerik team
 answered on 07 Nov 2013
4 answers
149 views
I am using Kendo UI Complete v2012.3.1315 and I am trying to allow the user to only navigate to a depth of a month. So I have set the navigation depth to month. I've also set the start config property to month. My understanding is my setting these config settings to a month will prevent the user from clicking the month name and getting a year, decade, and century view. Is this understanding correct? If so, is there another setting that must be set?

Thank you.

Kemal
Top achievements
Rank 1
 answered on 07 Nov 2013
1 answer
232 views
I'm using an EventTemplate to display in the agenda view.  I'd like to add a button in the template that will open the Edit window.  I've searched through the forums, but have not been able to find an example.  Can you provide an example showing how to do this?

Thanks,
-Pete
Rosen
Telerik team
 answered on 07 Nov 2013
2 answers
641 views
Hi, I am using Telerik's dropdownlist in my MVC application View. I am facing two problems:

 1) When I run my application, I find every value of kendo dropdownlist is "Undefined".
   This is the code for my View:
      @model IEnumerable<EulenMgrKendoUIMvcApplication.Dominio.Tablas.DelegacionProductoUsuario>

     @(Html.Kendo().DropDownListFor(d=>d)

            .Name("IdDelegacionProductoDrpDwn").HtmlAttributes(new { @style = "font-size:12px" })
            .DataTextField("IdDelegacionProducto")
            .DataValueField("IdDelegacionProducto")
            .BindTo((System.Collections.IEnumerable)ViewData["IdDelegacionProducto"]))

   This is my controller, where I populate the dropdownlist:
   public class DelegacionProductoUsuarioController : Controller
         public ViewResult List()
        {
            IEnumerable<DelegacionProductoUsuario> delegaciones = DelegacionProductoUsuario.GetAll();
          PopulateDelegacionProducto();
            return View(delegaciones);
        }
       private void PopulateDelegacionProducto()
        {
            List<Int64> IdDelegacionProductoList = new List<Int64>();
            foreach( DelegacionProductoUsuario d in DelegacionProductoUsuario.GetAll()){
                IdDelegacionProductoList.Add(d.IdDelegacionProducto);
            }
            ViewData["IdDelegacionProducto"] =IdDelegacionProductoList ;
        }
}

     I am debugging the application and the controller is passing to the view the proper values,so I don't understand why it doesn't show them.
 
2) Second problem: I insert this Dropdownlist in one of the columns of a kendo grid with no success. In it's place it appears a common label. Here is the code for
 my Grid, I mark in Bold the column where I try to show  my dropdownList:
      @(Html.Kendo().Grid(Model)
          .Name("Grid")
          .Columns(columns=>
          {
            columns.Bound(d => d.BorradoLogico).Title("Borrado logico");
            columns.Bound(d => d.FTick).Title("Ftick");
           columns.Bound(d => d.IdDelegacionProducto).Title("IdDelegacionProducto").EditorTemplateName("IdDelegacionProductoDrpDwn");    
            columns.Bound(d => d.IdUsuario).Title("IdUsuario");
         })
MAY SOMEBODY HELP ME PLEASE?
Goldfy
Top achievements
Rank 1
 answered on 07 Nov 2013
9 answers
665 views
I have 3 series of data (JSON) and am in MVC 4 but I cannot find any example or tutorial how to link the Json to a chart series?  Can you share a link?

Ok I have 3 series of data (ex.  3 countries and a sum for each country) can be string, json whatever....
using MVC 4  is there a clear example of using a view how I map these series to a chart????? 

I am searching Telerik/Kendo and no sample for MVC 4  and chart (not grid) is coming up.

Iliana Dyankova
Telerik team
 answered on 07 Nov 2013
1 answer
1.4K+ views
How do you bind a custom function to the "requestEnd" event of a dataSource with MVC notation? 

Dimiter Madjarov
Telerik team
 answered on 07 Nov 2013
1 answer
163 views
using syntax to bind to JSON series data, .SeriesColors array syntax error

@(Html.Kendo().Chart(Model)
.Name("chart1")
.Title("IV Capture")
.DataSource(dataSource => dataSource.Read(read => read.Action("FetchChartData", "Home"))
.Group(group => group.Add(model => model.SModality))
.Sort(sort => sort.Add(model => model.Zone).Ascending())
)
.Series(series =>
{
series.Column(model => model.IValue)
.Name("value")
.Stack(true);
})
 
.CategoryAxis(axis =>
axis.Categories(model => model.Zone)
.Labels(labels => labels.ToString())
)
.ValueAxis(axis => axis
.Numeric().Labels(labels => labels.Format("{0}"))
)
  .SeriesColors(["#cd1533", "#d43851", "#dc5c71", "#e47f8f", "#eba1ad","#99d7ef"])
)

above syntax is wrong for .SeriesColors

Iliana Dyankova
Telerik team
 answered on 06 Nov 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
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?