Telerik Forums
UI for ASP.NET MVC Forum
1 answer
2.9K+ views

Greetings!

 

I've implemented an EditorTemplate that uses Kedno.DropDownList for one of the model properties. Here is an example of it

1.@(Html.Kendo().DropDownList()
2.          .Name(ViewData.ModelMetadata.AdditionalValues["id"].ToString())
3.          .OptionLabel("not selected")
4.          .DataTextField("Name")
5.          .DataValueField("Id")
6.          .DataSource(ds => ds.Read(a => a.Action("GetAvailiableOrders","Orders")))
7.          .Filter(FilterType.Contains)
8.

I use this model to populate grid, like so

01.@(
02.    Html.Kendo().Grid<CustomerViewModel>()
03.    .Name("customersGrid")   
04.    .ToolBar(toolbar =>
05.    {
06.        if (!Model.ReadOnly)
07.        {
08.            toolbar.Create();
09.        }
10.    })
11.    .Editable(e => e.Mode(GridEditMode.InLine).CreateAt(GridInsertRowPosition.Bottom))
12.    .Resizable(resize => resize.Columns(true))
13.    .Columns(c => {
14.        c.Bound(s => s.Order); //EditorTemplate will be used here
15.        c.Bound(s => s.ConsumerName).Format("{0:dd.MM.yyyy}");
16.        c.Bound(s => s.OrderDate).Format("{0:dd.MM.yyyy}");
17.        if (!Model.ReadOnly)
18.        {
19.            c.Command(command =>
20.            {
21.                command.Edit();
22.                command.Destroy();
23.            });
24.        }
25.    })
26.    .DataSource(d => d.Ajax().
27.    Model(m =>
28.    {
29.        m.Id(p => p.Id);
30.        m.Field(p => p.Id).DefaultValue(default(long));
31.    })
32.    .Read(a => a.Action("GetCostumers","Costumers"))
33.    .Create(a => a.Action("CreateCostumer", "Costumers"))
34.    .Update(a => a.Action("UpdateCostumer","Costumers"))
35.    .Destroy(a => a.Action("DeleteCostumer", "Costumers"))
36.    )
37.)

I need some how to pass additional argument to the DataSource Read method,this parameter depends on other model property an is uiniqe for each grid row.

.DataSource(ds => ds.Read(a => a.Action("GetAvailiableOrders","Orders"))) //Need to pass additional argument here dependting on current row

Is there any way to implement this?

Ivan Danchev
Telerik team
 answered on 09 Aug 2016
1 answer
85 views

Hi,

I have a grid with some of the filters set. In the toolbar I have a new button going to a new page.

After inserting a new line in the grid I want to go back to the origional grid and set all the filters again.

 

Is this possible?

 

In the example in the attachment:

I have filtered on Project Number and Project Subnumber and pressed new which give me the bottom part of the image on a new webpage.

 

After pressing back or save I want to let the user going back to the old filtered information.

 

With kind regards,

 

Maurice Lucas

 

Konstantin Dikov
Telerik team
 answered on 09 Aug 2016
2 answers
278 views

I have two grids with pageSize enabled which includes 'All' text to display all the items of the grid. There is a button in the form which when clicked will move items from one grid to other. The issue is when i select pageSize 'All' and click the button to move the item, the pageSize label changes to total count of the grid item. e.g. if grid1 has 50 items and if i move 1 item from grid1 to grid2, the pageSize text 'All' changes to '50' in grid1 after the move is performed. 

I have created sample which has grid and delete button to remove one item from grid to mock this behavior. To replicate this behavior, select 'All' in the grid and click 'Delete' button. You should see '4' in the pageSize after the removal of the item from the grid. 

http://dojo.telerik.com/eqIDe/2

Is there anyway to have 'All' text selected even after the removal of item from grid1?

Thanks.

Avinash

Avinash
Top achievements
Rank 1
 answered on 08 Aug 2016
4 answers
1.9K+ views

I'm struggling on how to set the color of a cell in the grid based on data.  I see where this question has been asked a lot before - but I'm not seeing an answer that is understandable to me.

I am using ASP.NET MVC with a grid that has an AJAX datasource.  The datasource returns a column that contains the color I want the cell to be. 

The view's model contains the selection fields for the page.  The grid is using a different class named: PlannedProjectList.  There is a field in PlannedProjectList that contains the color of the cell.

@model LRFP.ViewModels.PlannedProjectSelection 

@(Html.Kendo().Grid<LRFP.ViewModels.PlannedProjectList>()

 

I was able to set the color of the cell with this.  But I don't want to use a model field.  Because each row can be a different color.  So I need to use a field from the data on the grid.

columns.Bound(c => c.PlannedProjectName).HtmlAttributes(new { style = "color: " +  @Model.fieldColor + "  ;" });

Is it possible to do what I'm asking?  Or is there another way?  If so, please show a detailed example.  I'm a newbie - so the more detailed example the better.

Thanks for your help.

Terry
Top achievements
Rank 1
 answered on 08 Aug 2016
2 answers
76 views

I'm trying to get around a bug with the Kendo Editor control in Internet Explorer (tested in IE11).

JS Fiddle here:
https://jsfiddle.net/L5tvccd9/

 

Repro steps:
1. Click inside one word (e.g. "nine")
2. Select All (Ctrl+A, but it also happens with example select all from docs: http://docs.telerik.com/kendo-ui/api/javascript/ui/editor#methods-selectRange )
3. Click inside a different word (e.g. "five")
4. Press return on the keyboard

 

Expected behaviour is to insert a break inside the second selected word, where the caret correctly appears (e.g. "five")

Actual behaviour is to insert a break inside the first selected word, where the caret was before select all (e.g. "nine")

This also breaks a lot of other features, like setting the style buttons to the correct state because it doesn't know where the caret is.

A second click in the same location, or using the keyboard cursor keys etc. correctly sets the caret position.

Also reproducible on the demo control:
http://demos.telerik.com/kendo-ui/editor/index

 

Is there any fix or workaround for this?

Ianko
Telerik team
 answered on 08 Aug 2016
0 answers
105 views

Hi, 

I installed  telerik.ui.for.aspnet.core(v2016.2.714) by NuGet in VS2015, but I got a error like the attached NuGet installation image and log. Could you please help to check it? Is there any special setting for the installation?

BTW, I can't submit my support ticket through login to my account (investigating), I want to get your support from here as suggest from your support team.

Regards,

Amstrong,

Aug.8, 2016

Amstrong
Top achievements
Rank 1
 asked on 08 Aug 2016
5 answers
189 views
Hi, I need to display a total count per series in a note at end of bar per attachment.  The attachment is a screenshot of equivalent functionality in Telerik UI for AJAX page that I am converting over to MVC.

Chart syntax at moment:
​
@(Html.Kendo().Chart()
    .Name(Model.ChartName)
    .Title(title => title
        .Text(Model.ChartTitle)
        .Align(ChartTextAlignment.Left)
    )
    .HtmlAttributes(new { @class = "dashboardChart" })
    .Legend(legend => legend
        .Visible(Model.LegendVisible)
        .Position(ChartLegendPosition.Right)
    )
    .Series(series =>
    {
        series.Bar(new double[] { Model.AgedCount }).Name(Model.ChartAgedSeriesTitle).Color(myapp.Controllers.DashboardController.ChartSeries1Color);
        series.Bar(new double[] { Model.UnAgedCount }).Name(Model.ChartUnAgedSeriesTitle).Color(myapp.Controllers.DashboardController.ChartSeries2Color);
    })
    .ValueAxis(axis => axis.Numeric()
        .MinorUnit(1)
        .MajorUnit(Model.ChartMaxValue <= 10 ? 1 : 5)
        .Min(0)
        .Max(Model.ChartMaxValue)
        .MajorGridLines(lines => lines.Visible(true))
        .MinorGridLines(lines => lines.Visible(true))
        .Visible(true)
        .Labels(labels => labels.Visible(true))
        .MinorTicks(ticks => ticks.Visible(true))
    )
    .Tooltip(tooltip => tooltip
            .Visible(true)
    )
    .Events(events => events
                .SeriesClick("onSeriesClick")
            )
)
Doug
Top achievements
Rank 1
Veteran
 answered on 07 Aug 2016
1 answer
254 views

I have a controller like so: 

1.public async Task<ActionResult> ActionMethod([DataSourceRequest] DataSourceRequest request){...}

When I set a filter on the UI, the controller receives a request object populated with a filter object. 

When I examine the traffic between the client and server I see a string for filter like this:

filter: FirstName~contains~'John'

I imagine there is a Model Binder some where that knows how to instantiate a filter object based on that string.

In this case, the results would be filtered to all entries with a First Name containing John. 

My question is: Is there a way to pass a similar string to the Model Binder from another action? 

For example, 

From another action, I want to create a string like "FirstName~contains~'Mary'" and then Redirect to the "ActionMethod" action pasted above. When the "ActionMethod" is called, I would like the filter object to be constructed so that results would be filtered to all entries with a First Name containing Mary, instead of John. Is this possible? 

 

Kostadin
Telerik team
 answered on 05 Aug 2016
5 answers
185 views

We have large trees that contains multiple levels like:

Root

  Item 1

    Item1-A

    Item1-B

  Item 2

    Item2-A

    Item2-B

The children are loaded dynamically using the onselect event for the item, so using the above example, Item1-A has children, but they have not yet been loaded when the tree is created. Item1-A will display with the expand arrow.

Clicking on the Item1-A (text in the tree), expands to show the children, however when clicking on the expand arrow next to Item1-A, the expand arrow disappears, the Item1-A text is selected, but the onselect event is not fired so the children are not displayed.

We don't want to load the next level children (which does resolve the problem) due to performance requirements.

Is there any way we can either

a) Disable the expand arrow action (i.e. we are happy if the user consistently just clicks on the item text and the expand arrow is for display only)

or

b) Fire a select event when clicking on the expand arrow so that it performs the same action as clicking on the text in the tree.

Thanks.

Ivan Danchev
Telerik team
 answered on 04 Aug 2016
1 answer
237 views
Any ideas on how to either specify a field is editable if only a edit, and not a new record being added to the grid.  Either inline or popup.  What 'm trying to do is have a field required to be entered on new, but not editable afterwards.

Ideally, a way in the future to specify which editortemplate view to use on new or edit would be extremely helpful. Since it looks like I'll have inline editing, but can't use the grid create, instead it will just be a button with a custom window and form.
Eyup
Telerik team
 answered on 04 Aug 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?