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

I have worked based on : .Filter(filter => filter.Add(/* your filter rule */)) , that I found in here.

 My code is : 

  var grid =
        Html.Kendo().Grid<dynamic>().Name(Model.Current.Id).HtmlAttributes(new
        {

           // lot of stuff

       }

 grid.DataSource(ds =>
    {
        var ajaxDsBuilder = ds.Ajax();
        ajaxDsBuilder.Model(model => model.Id("ID")).Events(ev => ev.Error("gridOnError")).ServerOperation(Model.Current.LazyLoading);

// mode code

      var cols = Model.Current.Columns.ToList();

           foreach (var col in cols)
              {​

                 ajaxDsBuilder.Sort(sort => sort.Add(col.Name).Ascending()); // this works perfect for pre-sorting     ( col.Name = the column name ) 

                 ajaxDsBuilder.Group(grp => grp.Add(col.Name, typeof(string))); // this the same works great for pre-grouping

 

 ​but when I try this:

          ajaxDsBuilder.Filter(f => f.Add(c=> c.col.Name).IsEqualTo("TEST")); ​

I get : Error309 An expression tree may not contain a dynamic operation 

 

if I try:  ajaxDsBuilder.Filter(f => f.Add(c=> col.Name.ToString()).IsEqualTo("TEST")); ​// I am overriding ToString() to give me the name of column

I get : Internal server error

 

 if I try:  ajaxDsBuilder.Filter(f => f.Add(c=> col.Name).IsEqualTo("TEST")); 
I get : Property with specified name: col.Name cannot be found on type: System.Data.DataRowView

 

I have also worked with lambda expressions, but I have pretty much the same errors. 

My grid has to be dynamic, so I can't change that.

Any help?

Anca
Top achievements
Rank 1
 answered on 10 Sep 2015
8 answers
1.6K+ views

Hello.

 I am using the following:

 Asp.net MVC 5

Ajax binding

Inline Editing

I need to pass a value to to the grid so it is populated automatically (see attached screenshot).  I have google'd looked at these forums, but the following doesn't seem to populate the value in the grid.

.Read(read => read.Action("CustomerClass_Read", "CustomerClass").Data("{ CustomerId: " + @Model.CustomerId + "}"))

I know how to do this with through an Actionlink:

 

@Html.ActionLink("New", "Create", "ShipTo", new { CustomerId = Model.CustomerId }, new { @class = "btn btn-default btn-sm" })

Please advise.

 Thanks

 

Jeff
Top achievements
Rank 1
 answered on 09 Sep 2015
4 answers
1.5K+ views
Anyone know how I can display a utc date/time I'm getting from my server as the user's local time? I'm putting this date/time in a ClientRowTemplate if that matters. 
Radoslav
Telerik team
 answered on 09 Sep 2015
1 answer
524 views
Hello,
I have a problem with setting the selection color in Kendo Editor in inline mode.
What I've discovered is that if a text inside the editor is not formatted everything is fine (meaning, selecting text with mouse highlight it with system defined color). Eveything breaks when add some styling. Bolding or underscoring text results in while color when selecting text.

I've observed the same issue on Components page (http://demos.telerik.com/kendo-ui/editor/inline-editing)

What could be the solution for this issue?
Dimo
Telerik team
 answered on 09 Sep 2015
4 answers
449 views
I'm trying to add a sparkline column into a grid.
I've tried using a client template to do this, but it just shows [object HTMLScriptElement] in the column, rather than the chart.

I have a template:-
<script id="sparkTemplate" type="text/kendo-tmpl">
 
     @(Html.Kendo().Sparkline()
                        .Name("temp-log_#=ID#")
                        .Type(SparklineType.Column)
                        .Tooltip(tooltip => tooltip.Format("{0} °C"))
                         
                        .Data(ViewBag.TemperatureData)
                        .ToClientTemplate()
               )
 
</script>
This doesn't yet have pass any parameters to the controller - but obviously this will be needed as well.
The grid is:-
        @(Html.Kendo().Grid<CMS_2013.Models.CMSSummaryOne>()
.Name("tabGrid")
.Columns(columns=>
    {columns.Bound(p=>p.DivisionName).Title("Division");
    columns.Bound(p => p.Specialty).Title("Specialty");
    columns.Bound(p => p.Activity).Title("Activity");
    columns.Bound(p => p.Plan).Title("Plan");
    columns.Bound(p => p.Variance).Title("Variance").ClientTemplate("#= formatNumber(Variance) #");
    columns.Bound(p => p.Variance).Title("Variance").ClientTemplate("#=sparkTemplate#");
    })
     
     
   
    .Pageable()
    .Sortable()
    .Selectable()
 
    .DataSource(dataSource=>dataSource
        .Ajax()
        .PageSize(5)
         
        .Read(read=>read.Action("GetTableData","Dashboard")
        .Data("chartFilter")
        )
        )
         
   
       )

What's the best way to embed a chart into a column - I specifically want the chart in a column and not a detail template - something a sparkline looks ideal for.

Thanks
Dimiter Madjarov
Telerik team
 answered on 08 Sep 2015
3 answers
53 views

Hello

I have a grid displaying workitems and the last action taken for a workitem, recently I discovered that I need to extend this to include a history of actions stored in a separate table in the db.

the two tables looks like this:

workItem
id
name
lastActionDate
lastActionText

workAction
id
workItemID
actionDate
ActionText

My model currently looks like this:

public class workItemModel
    {
        public int id { get; set; }
        public string name{ get; set; }
        public DateTime lastActionDate{ get; set; }
        public string lastActionText{ get; set; }
    }

and my read action for the grid looks like this:

public ActionResult workItems_Read([DataSourceRequest]DataSourceRequest request)
        {
            return Json(GetWorkItems().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
 
        private static IEnumerable<workItemModel> GetWorkItems()
        {
            var wimDB = new wimDB_DEVEntities();
            return wimDB.workItem.Select(wiModel => new workItemModel
            {
                id = wiModel.id,
                name = wiModel.name,
                lastActionDate = wiModel.lastActionDate,
                lastActionText= wiModel.lastActionText
            });
        }
 

How do I extent my model and my read action to include the workAction table from the db?

/Jonas

Jonas
Top achievements
Rank 1
 answered on 08 Sep 2015
1 answer
97 views

Hi ,

   We are planning to switch the project from  Silverlight to MVC , So we need Telerik MVC supporting dlls .
Could you please tell me where I have to found those dlls  , I have downloaded UI for ASP.net MVC from Telerik site but I could not found any MVC dll’s  .
Can you please tell me from where I can get those dll’s .

 

Thanks

Victor

Sebastian
Telerik team
 answered on 08 Sep 2015
6 answers
2.2K+ views
Hello

I have a grid showing data (registrations) with the possibility to edit this data.
Each registration stores information about a region, stored in the DB as forgein key regionId for each registration.

When I edit a registration I want a dropdown for choosing region with the current region selected. The dropdown gets its values from the region table in the DB.
As I load the dropdown I think I loose the registration model and it gets replaced by the region model and thus I have no access to the regionId for the registration anymore, how can I get hold of the regionId value in the dropdown?

My editTemplate:
@model regDB.Models.registration
 
@Html.HiddenFor(model => model.id)
 
<div>
    @Html.EditorFor(model => model.regionId)
</div>
 
<div style="width: 250px;">
    @(Html.Kendo().DropDownList()
          .Name("Regions")
          .HtmlAttributes(new { style = "width: 250px" })
          .DataTextField("name")
          .DataValueField("id")
          .Value(model.regionId)
          .DataSource(source =>
          {
              source.Read(read =>
              {
                  read.Action("GetRegions", "Home");
              });
          })
    )
</div>
 and the GetRegions code:
public JsonResult GetRegions()
        {
            var regDB = new regDB_DEVEntities();
            regDB.Configuration.ProxyCreationEnabled = false;
            return Json(regDB.region, JsonRequestBehavior.AllowGet);
        }
If I remove the ProxyCreationEnabled, I'll get a circular reference error.

I hope you understand my question, otherwise i'll have to try to explain some more

/Jonas
Georgi Krustev
Telerik team
 answered on 08 Sep 2015
5 answers
114 views

Dear Telerik Community,

 I've recognized some weird behavior of the DatePickerWidget when switching from one month to another. You can take a look at the screen shot to see exactly what I'm talking about. I don't know if this already came up to somebody of you - I hope it did so someone can help me fix it.

 Kind regards,

Thomas

Iliana Dyankova
Telerik team
 answered on 07 Sep 2015
14 answers
130 views
Is there an beta/test UI for ASP.NET MVC for vNext (aka MVC 6)? Our team is starting to develop an .NET MVC 5 application, however, the concern is that by the time the product reaches a mature development stage, it will be immediately depreciated by MVC6.
T. Tsonev
Telerik team
 answered on 07 Sep 2015
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
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
DateTimePicker
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?