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

How do you specify an area when binding to a model?  I'm working on an ASP.NET MVC website using Areas, and using the Kendo().Menu() helper to build the menu.  I'm using the BindTo() method to bind the menu to a model that is based on Kendo.MVC.UI.MenuItem.  How do I tell the helper which area (i.e. which route) to use, and how do I specify that a particular controller is NOT in any of the areas.  The following example code example might help to illustrate the problem I'm having:

using System.Collections.Generic;
using System.Web.Routing;
using My.Resources.Views.Shared;
using Kendo.Mvc.UI;
 
namespace My.Web.Configuration
{
    public class MyMenuItem: Kendo.Mvc.UI.MenuItem
    {
        public int Id { get; set; }
        public IEnumerable<MyMenuItem> SubItems { get; set; }
    }
 
    public class MySiteMap
    {
        public MySiteMap()
        {
            MenuItems = new List<MyMenuItem>
            {
                // There is an AccountController in an Area named 'Admin'
                 
                // Neither one of the following approaches works. I think I'm close here, but I'm missing something
                // new MyMenuItem { Text = "Log In", ControllerName="Account", ActionName="Login", RouteName = "Admin"},
                // new MyMenuItem { Text = "Log In", ControllerName="Account", ActionName="Login", RouteValues = new RouteValueDictionary(new {area = "Admin"})},
 
                // The following line works the first time you click on it, but an error occurs the second
                // time, or when you try to navigate anywhere else, because the helper appends all links
                // to the Area name, once you've navigated to said area (e.g. "Home" becomes "Admin/Home"
                // which is incorrect).
                new MyMenuItem { Text = MenuResources.MenuLogin, ControllerName="Admin/Account", ActionName="Login" },
 
                // How do I tell the Kendo().Menu() helper that the 'Home' controller, e.g., is not located
                // in the 'Admin' area?
                new MyMenuItem { Text = MenuResources.MenuAbout, ControllerName="Home", ActionName="About" },
                new MyMenuItem
                {
                    Text = MenuResources.MenuProjects, ControllerName="Projects",
                    ActionName="Index",
                    SubItems = new List<MyMenuItem>
                    {
                        new MyMenuItem{Text = MenuResources.MenuProjectX,  ControllerName="Projects", ActionName="ProjectX"},
                        new MyMenuItem{Text = MenuResources.MenuProjectY, ControllerName="Projects", ActionName="ProjectY"}
                    },
                },
                new MyMenuItem { Text = MenuResources.MenuNotesToSelf, ControllerName="Blog", ActionName="Index" }
            };
            SiteMapName = "Root"; // Never displayed
        }
 
        public string SiteMapName { get; set; }
        public IEnumerable<MyMenuItem> MenuItems { get; set; }
    }
 
}

Darryl
Top achievements
Rank 1
 answered on 08 Apr 2015
5 answers
2.3K+ views
I have a dropdown editor like so:

model CCProMVC.Models.DivisionModelView

@(Html.Kendo().DropDownList()
    .Name("DivisionDDL")
    .DataTextField("DivisionName")
        .DataValueField("DivisionID")
    .DataSource(d => d
    .Read(r => r.Action("GetDivisions", "Client",<Need to pass Parent ID here from selected grid>))
    )
)

It's used in a Child grid. I need to pass the parent grids ID on the dropdowns read.

Reason why (I'll try and keep it short) I have a Client (grid) that can have Divisions.  The client can also have Stores that are part of a Client-Division.  I want to display in the Store grid's (child)  Division dropdown only those divisions for the given Client.

Any suggestions would be helpful.

Thanks
Petur Subev
Telerik team
 answered on 07 Apr 2015
1 answer
495 views

Hi, in dropDownList widget i can set valueTemplate property to define a custom selected value template.

I need to do the same with comboBox but it does't have valueTemplate property..

How can i do?

Thanks

Boyan Dimitrov
Telerik team
 answered on 07 Apr 2015
3 answers
196 views
Hello,

Here is the situation. I have a treeview that basically represents directory, sub-directory and files. For some reasons, I can't use the LoadOnDemand option. So I load all the tree in my controller.
Everything works fine except that it seems the Databound event is triggered for each directory and subdirectory. I was expecting the event to be triggered only once when all data are "loaded" from the datasource.
At the end, I need to expand some nodes everytime the datasource is refreshed

This is my treeview

    @(Html.Kendo().TreeView()
        .Name("treeview")
        .DataTextField("name")
        .LoadOnDemand(false)
        .DataSource(datasource => datasource.Read(read => read.Action("Tree_Read_All", "MyController"))
        .Model(model => model.Children("childrens")))
        .DragAndDrop(true)
        .Events(events => events
            .Select("treeViewOnSelect")
            .Drop("treeViewOnDrop")
            .DataBound("treeViewDataBound")
        )
    )

Thanks in advance
Kiril Nikolov
Telerik team
 answered on 07 Apr 2015
1 answer
145 views

Hello,

 Is is possible to set the height of a row after the databound ?
Let me explain why. Sometimes I have a lot of events and sometimes I don't. So I want to set the height of the row after the databound so I can show all the event in the row. The attached file will clarify my mind I think.

 

Thanks in advance for your response.

 

Vladimir Iliev
Telerik team
 answered on 06 Apr 2015
1 answer
571 views
I have a popup editor template with an editor in it and I'm trying to figure out how to set the value to the model field value. I have :

@(Html.Kendo().Editor()
      .Name("Body")
      .HtmlAttributes(new { style = "width: 590px;height:440px" })
      .Value(@Model.Body)
)

But that does not work. Anyone know the answer?
Alexander Popov
Telerik team
 answered on 06 Apr 2015
1 answer
217 views
I need to know the order in what the files were selected in an upload widget that is set to ASYNC, Allow multi and auto upload true. Any ideas how this can accomplish?
Dimiter Madjarov
Telerik team
 answered on 06 Apr 2015
1 answer
112 views
Hi All,

I am new to MVC ,so if i am wrong sorry in advance.
My application have one telerik grid. it contains several columns,
 one column is ajax action link (productid),it displays a partial view within the same page. upto this it works fine.
Now when i sort the telerik grid colum, it hides this partial view.
Below is my view:


@model IEnumerable<MvcApplication2.Models.Product>@{
ViewBag.Title = "WebgridSample";
}<h2>WebgridSample</h2>
@using Kendo.Mvc.UI; 



<script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>



@{
MvcApplication2.Models.Product product = new MvcApplication2.Models.Product();
}
<script src="~/Scripts/jquery-1.7.1.min.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
@Scripts.Render("~/bundles/jquery")



@Html.DisplayNameFor(model => model.Quantity)
</th>
<th></th>
</tr>@(Html.Kendo().Grid(Model).Name("ProductGrid")
.Columns(columns =>
{columns.Template(@<text>
@Ajax.ActionLink(@item.Id.ToString(), "Edit",
new { id = @item.Id,name=@item.Name,desc=@item.Description,quantity=@item.Quantity }, new AjaxOptions { HttpMethod = "GET", 
InsertionMode = InsertionMode.Replace ,
UpdateTargetId = "view-details"

}) 
</text>)
.Title("Id");
columns.Bound(o => o.Name);
columns.Bound(o => o.Description);
columns.Bound(o => o.Quantity);
})
.Pageable()
.Sortable()
)
<div id="view-details" >


</div>


and my controller action is given below:

public PartialViewResult Edit(string id)
{Product product = inventoryList.Single(t => t.Id == id);
return PartialView("_Product", product);
}

and my partial view is:

@model MvcApplication2.Models.Product
@{
Layout =null;
}<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />

</head>
<h2>Product Details</h2> 
<body>
<table ><tr><td><label>Id:</label></td><td>@Html.TextBox("Id", Model.Id)</td></tr>
<tr><td><label>Name:</label></td><td> @Html.TextBox("Name", Model.Name)</td></tr>
<tr><td> <label>Description:</label></td><td> @Html.TextBox("Description", Model.Description)</td></tr>
<tr><td><label>Quantity:</label></td><td> @Html.TextBox("Quantity", Model.Quantity)</td></tr>
</table>








</body>
</html>Thanks in advance :)
Dimiter Madjarov
Telerik team
 answered on 06 Apr 2015
2 answers
127 views
Hi, 

I am using Gantt and I have few issues.

1. When Gantt is first loaded it doesn't display task timeline. I have to select some other view first in order for it to appear.
2. If I use databoud event to set view ( var gantt = $("#Gantt").data("kendoGantt");
        gantt.view("week"); )  I have error Uncaught RangeError: Maximum call stack size exceeded. if i comment this all code in databoud  function executes fine


Is there any way to hide weeks if view is set to month view? Our client wants just to track by months since all projects are monthly.
Also can we hide days or hours if week and day view is selected.

Thank You
Bozhidar
Telerik team
 answered on 06 Apr 2015
1 answer
226 views
Hi All,
In the example : http://demos.telerik.com/aspnet-mvc/grid/toolbar-template , i want to filter my grid with multi-select. Is there any demo or tutorial about this ? 

Alexander Popov
Telerik team
 answered on 06 Apr 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
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
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?