Telerik Forums
UI for ASP.NET MVC Forum
2 answers
115 views

 

 

I can't seem to figure out why my grid doesn't show data. Here's the Contoller code:

public JsonResult PopulateGrid()
{
var x = (from n in dbContext1.GetOrders("Melody Devoe") select n);
List<string> items = new List<string>();
foreach (var item in x)
{
items.Add(item.ToString());
}

return Json(items.ToList(), JsonRequestBehavior.AllowGet);

}

 

Here's the cshtml:

<div class="a">
@(Html.Kendo().Grid<CentralBilling.Models.GetOrders_Result>()
.Name("gridRater")
.DataSource(datasource => datasource
.Ajax()
.Read(read => read.Action("PopulateGrid", "Home")))
.Columns(columns =>
{
columns.Bound(o => o.Order_Number);
//columns.Bound(o => o.ActDate);
//columns.Bound(o => o.Agent_Role);
//columns.Bound(o => o.aom_shipment_type);
//columns.Bound(o => o.Delay);
//columns.Bound(o => o.DeadlineDist);
//columns.Bound(o => o.DistStatus);
//columns.Bound(o => o.SubmitDate);
//columns.Bound(o => o.LastAct);
//columns.Bound(o => o.LastComment);
})
.Sortable()
.Scrollable()
.Filterable()
.Selectable()
)
</div>

I'm using a stored procedure pulled in through the Model. At first I had trouble with the proc parameter so I hardcoded one and still no luck. This is driving me crazy! Thanks in advance

Marin
Telerik team
 answered on 14 Oct 2016
1 answer
179 views

Ive written some extension methods for various UI components for example here is one for the TextBox

 

        public static TextBoxBuilder<T> Width<T>(this TextBoxBuilder<T> builder, int width)
        {
            return builder.HtmlAttributes(new { @style = "width:" + width.ToString() + "px" });
        }

 

However I cant get the syntax correct for the NumericTextBoxBuilder

 

        public static NumericTextBoxBuilder<T> Width<T>(this NumericTextBoxBuilder<T> builder, int width)
        {
            return builder.HtmlAttributes(new { @style = "width:" + width.ToString() + "px" });
        }

 

I get a message The type 'T' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'NumericTextBoxBuilder<T>'

 

I could find an example working on google, can anyone assist



Daniel
Telerik team
 answered on 14 Oct 2016
3 answers
358 views

In my spreadsheet decimal separator in number cells is dot instead of comma (with the latter being proper to my culture). I set kendo.culture before loading spreadsheet widget and while debugging the current culture setting values seems OK, but they are not applied to spreadsheet.

I have set  "#,##0.00" format to my number cells to display numbers properly and it works fine with a few exceptions:

- when writing a formula numbers must have dot separator

- loading data from external spreadsheet file in widget shows numbers with dot separator

 

Are there ways to get this done that I'm not aware of or this is just not supported, and if so are there plans to improve it in next versions?

Peter Milchev
Telerik team
 answered on 13 Oct 2016
1 answer
123 views

I have line chart that works well... except when in one serie there is just one value. Then I get wrong values all over... When I add a dummy record it works.

Do I do something wrong or is this a feature or bug?

 

    @(Html.Kendo().Chart<SignalRDoc.ViewModels.HistoryTot>()
    .Name("linechartteam")
    .Theme("Material")
    .Title("Utfall i procent per mÃ¥nad (Team och konsult)")
     .Legend(legend => legend
        .Position(ChartLegendPosition.Bottom))
    .DataSource(ds => ds.Read(read => read.Action("LineChartTeam", "Statistik"))
.Group(group => group.Add(model => model.Fnamn))
 
.Sort(sort => sort.Add(model => model.Period).Ascending())
)
    .Series(series =>
    {
 
        series.Line(model => model.Procent, categoryExpression: model => model.Period).Name("#= group.value #");      
 
 
    })
        .CategoryAxis(axis => axis
        .Categories(model => model.Period)
 
        .MajorGridLines(lines => lines.Visible(true))
 
 
        .Labels(labels => labels.Format("MMM"))
        )
        .ValueAxis(axis => axis.Numeric()
         .Labels(labels => labels.Format("{0:p1}"))
 
            .Line(line => line.Visible(true))
        )
        .Tooltip(tooltip => tooltip.Visible(true).Shared(true).Format("{0:p1}")
        )
 
 
    )
</div>

And the Controller

public ActionResult LineChartTeam(int? year, string team)
       {
 
           if (year == null)
           {
               DateTime dt = DateTime.Today;
               year = dt.Year;
 
           }
           var data = (from p in db.History
                       where p.Period.Year == year
                       where p.Team == team
                       
                       group p by new
                       { p.Fnamn, p.Period }
                      into areaGroup
 
                       
                       select new HistoryTot()
                       {
                            
                           Fnamn = areaGroup.Key.Fnamn,
                           
                           Antal = areaGroup.Sum(p => p.Antal),
                           Budget = areaGroup.Sum(p => p.Budget),
                            
                           Period = areaGroup.Key.Period
                            
 
                       }).ToList();
           return Json(data);
           
       }

Ianko
Telerik team
 answered on 13 Oct 2016
6 answers
212 views

When i simply try to open "Demos - UI for ASP.Net MVC" project/solution in VS 2015 (community edition), It just crashes. Similar behavior also is there when i try to create new project with Telerik options in VS 2015. Is this a known issue? Any work around?

What i tried so far before posting here :-)

1) I repaired my VS 2015 but did not help.

2) I also repaired Telerik - UI for ASP.Net MVC from Telerik control panel that led me to restart machine in the end but it also did not fix it.

Thanks much in advance for any help on this.

Viral

 

Arif
Top achievements
Rank 1
 answered on 12 Oct 2016
2 answers
1.0K+ views

I have tried a number of ways without sucess, what I am trying to achieve is an MVC Kendo Grid where there is a column that when clicked will display a dropdown list of fives images, stored in the model should just be a number of 1 to 5 but displayed in the column that actual image

Hope this makes sense and is achievable 

Thanks in advance for any help

 

Regards, 

Chris

Chris
Top achievements
Rank 1
 answered on 12 Oct 2016
3 answers
150 views

In the current edition, a bug has been introduced

When doing a row level filter and you us contains, typing something in where what you type is contained in a string will say no data found

You can see the bug here in the demo

http://demos.telerik.com/aspnet-mvc/grid/filter-row

in the ship name, type carnes, it shows no data found, hit enter and it will show you the records with carnes, 14 rows.

I would like to know if the drop down box that shows no records can be removed or fixed.

Pavlina
Telerik team
 answered on 12 Oct 2016
5 answers
434 views
It is possible to set the selection in a grid with paging and to show the page with the selection when the grid is initialized.
Gil
Top achievements
Rank 1
 answered on 12 Oct 2016
2 answers
189 views

Hi!

I'm using a kendo Scheduler in cshtml.

@(Html.Kendo().Scheduler<TaskViewModel>()
            .Name("scheduler")
            .Views(views =>
            {
                views.DayView();
                views.CustomView("CustomDateRangeView ");
            })
            .DataSource(d => d
                .Read("Read", "Home")
                .Create("Create", "Home")
                .Destroy("Destroy", "Home")
                .Update("Update", "Home")
            )
  
    )

In this scheduler I'm using a custom view defined below. This works fine but I want to group only the all-day events in one Event Count like this example: Create Custom month View with Event Count in Show More Button

I tried to create the method _positionEvent in the custom view but it didn't work...

I couldn't find any information about it, only examples but nothing explained. 

//extend the base MultiDayView
var CustomDateRangeView = kendo.ui.MultiDayView.extend({
    init: function (element, options) {
        kendo.ui.MultiDayView.fn.init.call(this, element, options); //call the base init method
        if (options.swipe) {
            this._bindSwipe(); //bind the swipe event
        }
    },
    options: { //set default values of the options
        numberOfDays: 7,
        swipe: false
    },
    calculateDateRange: function () {
        var selectedDate = this.options.date,
            numberOfDays = Math.abs(this.options.numberOfDays),
            start = getMonday(selectedDate),
            idx, length,
            dates = [];
 
        for (idx = 0, length = numberOfDays; idx < length; idx++) {
            dates.push(start);
            start = kendo.date.nextDay(start);
        }
        this._render(dates);
    },
    nextDate: function () {
        return kendo.date.nextDay(this.endDate());
    },
    previousDate: function () {
        var daysToSubstract = -Math.abs(this.options.numberOfDays); //get the negative value of numberOfDays
        var startDate = kendo.date.addDays(this.startDate(), daysToSubstract); //substract the dates
        return startDate;
    },
    _bindSwipe: function () { //bind the swipe event
        var that = this;
        var scheduler = that.element.closest("[data-role=scheduler]").data("kendoScheduler"); //get reference to the scheduler
        that.content.kendoTouch({ //initialize Kendo Touch on the View's content
            enableSwipe: true,
            swipe: function (e) {
                var action,
                date;
 
                if (e.direction === "left") {
                    action = "next";
                    date = that.nextDate();
                } else if (e.direction === "right") {
                    action = "previous";
                    date = that.previousDate();
                }
 
                //navigate with the scheduler
                if (!scheduler.trigger("navigate", { view: scheduler._selectedViewName, action: action, date: date })) {
                    scheduler.date(date);
                }
            }
        });
    }
});
 
function getMonday(d) {
    d = new Date(d);
    var day = d.getDay(),
        diff = d.getDate() - day + (day == 0 ? -6 : 1); // adjust when day is sunday
    return new Date(d.setDate(diff));
}

 

Thanks!

Carlos
Top achievements
Rank 1
 answered on 11 Oct 2016
7 answers
1.2K+ views

I am trying to bind enum dropdownlist ,

I checked the html source and find two different results.

First, it shows value="Distribution", the dropdownlist will select correct value.

<input data-val="true" id="TradeType" name="TradeType" type="text" value="Distribution" data-role="dropdownlist" readonly="readonly" style="display: none;">
<script>
    jQuery(function(){jQuery("#TradeType").kendoDropDownList({"change":TradeTypeChange,"dataSource":[{"Text":"Clearing","Value":"Clearing"},{"Text":"Contribution","Value":"Contribution"},{"Text":"Distribution","Value":"Distribution"}],"dataTextField":"Text","dataValueField":"Value"});});
</script>

Second, it shows value="1", so it will select wrong value. The correct value should be "DueInterest".

<input data-val="true" id="TDInterestType" name="TDInterestType" type="text" value="1" data-role="dropdownlist" readonly="readonly" style="display: none;">
<script>
    jQuery(function(){jQuery("#TDInterestType").kendoDropDownList({"dataSource":[{"Text":"CancelInterest","Value":"CancelInterest"},{"Text":"DueInterest","Value":"DueInterest"},{"Text":"ReceiptInterest","Value":"ReceiptInterest"}],"dataTextField":"Text","dataValueField":"Value"});});
</script>

I don't how it happened, how could I solved it that second's dropdownlist will select correct value ?

Peter Milchev
Telerik team
 answered on 11 Oct 2016
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?