Telerik Forums
UI for ASP.NET MVC Forum
2 answers
135 views
Remote Data Binding from DataBase is not working as per given Examples in the site ..

I have Columns Like

EmpId       EmpName     ReportTo
1                  Ram               Null
2                  Sam                 1
3                  Priya                1
4                  Mathi                2
5                  Muhil                2

i need it like this

>Ram
    >Sam
         Mathi
         Muhil
      Priya

Can you post me any other Examples for Treeview Controller and Model using Linq ..

ram
Top achievements
Rank 1
 answered on 05 Nov 2014
4 answers
567 views
I am using MVC Tabstrip . It seems to put a red-color outline for that tab page, every time we select a tab item. I want to change this color as shown in this page (probably sort of greyish blue). How do i do that?

http://demos.telerik.com/aspnet-mvc/tabstrip/index


Arul
Top achievements
Rank 1
 answered on 05 Nov 2014
6 answers
3.1K+ views
There appears to be a problem using the Kendo ComboBox and DropDownList along with the client-side MVC unobtrusive validation. The validation errors do not appear on the client. Take the following Razor view for example:

@using Kendo.Mvc.UI
@model KendoDropDownTest.Models.TestModel
 
@{
    ViewBag.Title = "Kendo Drop Down and Combo Box Test";
}
 
<h2>Kendo Drop Down and Combo Box Test</h2>
 
@using (Html.BeginForm())
{
    @Html.ValidationSummary()
     
        <div>
            @Html.LabelFor(x => x.DropDownValue)
            @(Html.DropDownListFor(x => x.DropDownValue, Model.Options, "-- Select an Option --"))
            @Html.ValidationMessageFor(x => x.DropDownValue)
        </div>
 
    <fieldset>
        <legend>Kendo</legend>
        <div>
            @Html.LabelFor(x => x.KendoComboValue)
            @(Html.Kendo().ComboBoxFor(x => x.KendoComboValue)
                  .BindTo(Model.Options.Select(x => x.Text)))
            @Html.ValidationMessageFor(x => x.KendoComboValue)
        </div>
 
        <div>
            @Html.LabelFor(x => x.KendoDropDownValue)
            @(Html.Kendo().DropDownListFor(x => x.KendoDropDownValue)
                .OptionLabel("-- Select an Option --")
                .BindTo(Model.Options))
            @Html.ValidationMessageFor(x => x.KendoDropDownValue)
        </div>
    </fieldset>
     
    <input type="submit" value="Submit" />
}

The non-Kendo UI drop down appropriately shows the validation error when the form is submitted, but the Kendo controls do not. The model is very simple and uses attributes for validation:

public class TestModel
{
    [Required]
    public string DropDownValue { get; set; }
    [Required]
    public string KendoComboValue { get; set; }
    [Required]
    public string KendoDropDownValue { get; set; }
 
    public SelectListItem[] Options = new[]
    {
        new SelectListItem
        {
            Text = "Option 1",
            Value = "1"
        },
        new SelectListItem
        {
            Text = "Option 2",
            Value = "2"
        },
        new SelectListItem
        {
            Text = "Option 3",
            Value = "3"
        },
    };
}

Please let me know if there is a way to enable the client-side validation for these controls without having to manually wire it up. A solution which reproduces the issue is attached.
Georgi Krustev
Telerik team
 answered on 05 Nov 2014
5 answers
583 views
(1) I am using MVC application with Kendo MVC wrapper with razor syntax.
     I am trying to change a text of a tab item when a tab item is selected. How do i do that?

For example, disabling another tab-item when a tab is selected is NOT working with the current code.

==============================================================
event handler code (NOT working as far as disabling the tab item):

<script>
   function tabMain_select(e) {
        // gives valid item here - i checked in the debugger.
        var tabstripD = $("#tabMain").kendoTabStrip().data();      
        $(tabstripD).disable(0);
</script>

===========================================================
Code that renders the tab with three tab items (this works):
@(Html.Kendo()
    .TabStrip()
    .Name("tabMain")
    .Animation(false)
    .Events(e=>e.Select("tabMain_select"))
    .Items(tabs => 
                {
                    tabs.Add().Text("Recent History")
                              .Selected(true)                               // Will render as this tab selected
                              .LoadContentFrom("About","home");             // to render a view into this tab. 
                      
                    tabs.Add()
                        .Text("Package")
                        .LoadContentFrom("About","home")
                        .HtmlAttributes(new { style = "margin-right:60px" }); // To give space after this tab but before the next tab item.

                    tabs.Add()
                        .Text("Dirty Returns")
                        .LoadContentFrom("About", "home");
                }
            )
  )
=========================================================

Dimiter Madjarov
Telerik team
 answered on 05 Nov 2014
3 answers
161 views
after upgrading to latest version of kendo asp.net mvc 2014.2.903, it is making javascript error "Invalid Template".
It is observed that error occurs if hierarchical grid is filterable, for testing here is the sample code take from the example, i have changed this code to make sub grid as Filterable


@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.EmployeeViewModel>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(e => e.FirstName).Width(110);
            columns.Bound(e => e.LastName).Width(110);
            columns.Bound(e => e.Country).Width(110);
            columns.Bound(e => e.City).Width(110);
            columns.Bound(e => e.Title);
           
        })               
        .Sortable()
        .Pageable()
        .Scrollable()
        .ClientDetailTemplateId("template")
        .HtmlAttributes(new { style = "height:430px;" })
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(6)
            .Read(read => read.Action("HierarchyBinding_Employees", "Grid"))            
        )        
        .Events(events => events.DataBound("dataBound"))
)

<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.OrderViewModel>()
            .Name("grid_#=EmployeeID#")
            .Columns(columns =>
            {
                columns.Bound(o => o.OrderID).Width(70);
                columns.Bound(o => o.ShipCountry).Width(110);
                columns.Bound(o => o.ShipAddress);
                columns.Bound(o => o.ShipName).Width(200);
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(10)
                .Read(read => read.Action("HierarchyBinding_Orders", "Grid", new { employeeID = "#=EmployeeID#" }))
            )
            .Pageable()
            .Sortable()
            .Filterable()
            .ToClientTemplate()
    )
</script>
<script>
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }
</script>
Dimiter Madjarov
Telerik team
 answered on 05 Nov 2014
2 answers
125 views
I have a grid with 2 child grids defined as client templates. I want to handle server side validation as described here: http://blogs.telerik.com/kendoui/posts/13-08-29/handling-server-side-validation-errors-in-your-kendo-ui-grid but I am unsure of how to have the javascript for each client grid as each grid has a different ID and will need a different errors list.
Spirent
Top achievements
Rank 1
 answered on 04 Nov 2014
1 answer
209 views
I have a grid(see below) with specified widths for the columns.  Once the page starts to render the widths are correct; as soon as the grid is databound it auto generates widths for the columns.  The issue is that these new widths are nothing like what I have specified.  Any ideas?

 <%= Html.Telerik().Grid<WebUI.Models.UserMaintenance>()    
    .Name("CheckedUsers")
    .DataKeys(keys => 
    { 
        keys.Add(u => u.Id); 
    })      
    .Columns(columns =>        
    {
        //columns.Bound(u => u.Id).Hidden(true);
        //columns.Bound(u => u.Name).Width(350);
        columns.Bound(item => item.UserId).Title("User Id").Width(5);
        columns.Bound(item => item.FirstName).Title("First Name").Width(15);
        columns.Bound(item => item.LastName).Title("Last Name").Width(15);
        columns.Bound(item => item.OrgName).Title("Org Name").Width(25);
        columns.Bound(item => item.Email).Title("Email Address").Width(20);
        columns.Bound(item => item.Language).Title("Language").ReadOnly().Width(10);
        columns.Bound(item => item.ApplicationAssigned).Title("Applications").ReadOnly().Width(15);
        columns.Bound(item => item.ComplianceAssigned).Title("Compliance").ReadOnly().Width(51);
        columns.Bound(item => item.UserType).Title("User Type").ReadOnly().Width(15);
        columns.Bound(item => item.LastActivityDate).Title("Last Sign In").ReadOnly().Width(15);
        columns.Bound(item => item.LockedOut).Title("Locked Out").ReadOnly().Width(5);
        columns.Command(commands =>
            {
                commands.Custom("unlock").Text("Unlock").Ajax(true);
            }
            ).Title("Unlock User").Width(5);
        columns.Command(commands =>
        {
            commands.Edit().ButtonType(GridButtonType.Image);
            commands.Delete().ButtonType(GridButtonType.Image);
        }).Width(5);
       
    })
    .Editable(editing => editing.Mode(GridEditMode.InLine))
    .Filterable()
    .Sortable()
           //.ClientEvents(clientEvents => clientEvents.OnDataBinding("onDataBinding").OnDelete("onCheckedUsersDelete").OnError("onCheckedUsersError"))
    .ClientEvents(clientEvents => clientEvents.OnDelete("onCheckedUsersDelete").OnError("onCheckedUsersError").OnSave("onCheckedUsersSave").OnCommand("onCheckedUsersCommand"))
    .DataBinding(dataBinding => dataBinding.Ajax().Select("_GetAllMembershipUser", "Survey")
                                                    .Delete("_DeleteMembershipAssigned", "Survey")
                                                    .Update("_EditMembershipUser","Survey"))
    .HtmlAttributes(new { style = "min-width:1500px" })

    %>
Dimiter Madjarov
Telerik team
 answered on 04 Nov 2014
1 answer
931 views
OK it seems to me that this should be a simple thing but for some reason it is not documented anywhere (at least I can't find it).
Using:
http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/menu/overview#bind-kendo-menu-to-a-hierarchical-model

I have a working menu EXCEPT hyper links

Sure I can get it to fire the select event. What exact is being passed in. I can't get the values I set on the "item" object (Text or Url).

What are the available properties for the "item" object in the above example?

All I need to do is make the select function redirect to a new page. I would think that this is what 99% of your users would want to do. Why is an end-to-end example of a hierarchical model with hyperlinks not given?

Please provide this.

@(Html.Kendo().Menu()
.Name("adminMenu") //The name of the menu is mandatory. It specifies the "id" attribute of the widget.
.BindTo(Model, mappings =>
{
mappings.For<McGladrey.DOTT.DataModel.DOTTCustom.sp_GetUserTreeData_Result>(binding => binding //define first level of menu
.ItemDataBound((item, parent) => //define mapping between menu item properties and the model properties
{
item.Text = parent.NodeName;
})
.Children(parent => parent.ChildrenNodes)
); //define which property of the model contains the children
mappings.For<McGladrey.DOTT.DataModel.DOTTCustom.sp_GetUserTreeData_Result>(binding => binding
.ItemDataBound((item, child) =>
{
item.Text = child.NodeName;
item.Url = child.NodeAction;

}));
})
.Events(e=>e.Select("MenuSelected"))
.Orientation(MenuOrientation.Vertical)
)

<script type="text/javascript">

function MenuSelected(e)
{
alert(e.item.Text + " " + e.item.Url);

}
</script>

-Martin
Petur Subev
Telerik team
 answered on 03 Nov 2014
1 answer
154 views

I have a Kendo grid :        

@(Html.Kendo().Grid<MyVm>().Name("grid").Columns(columns =>
      ...
    .DataSource(dataSource => dataSource
            .Ajax()
            .Model(model => model.Id(p => p.Id))
            .Read(read => read.Action("List", "MyController", new { id = Model.Id }).Type(HttpVerbs.Get)))

On my controller I have :   

public JsonResult List([DataSourceRequest] DataSourceRequest request, int id)
    {
         //if (FIRST/INITIAL LOADING) ?????
         ...
    }

How can I check on controller if its the initial loading/binding?

Thanks
Nikolay Rusev
Telerik team
 answered on 03 Nov 2014
1 answer
180 views
Hi Guys,

I have built a WebAPI for user login, the webAPI can generate Access Token, if the user provided correct UserName and password. My Question is how I can pass user role information to the MVC application also.

For example,

I have a MVC app controller below, how can I pass the role 'Admin, UserEditor' from the Web API? I know I can use another WebAPI call to check user role, but it is not a good idea to do it. 

[Authorized("Admin,UserEditor")]
ActionResult EditUser(int? Id)
{
........
}  

Best Regards,
KIM
Petur Subev
Telerik team
 answered on 31 Oct 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
Window
ListView
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
Licensing
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
AICodingAssistant
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
+? 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?