Telerik Forums
UI for ASP.NET MVC Forum
2 answers
87 views
Hi,

I'm trying to filter on value from parent GRID  (dynamically)  
.Filter(filter => filter.Add(prod => prod.COUNTER_PRNITER_ID).IsEqualTo(decimal.Parse("# =PRINTER_ID#")))
But he try to parse the string not the value of printer id

the COUNTER_PRNITER_ID is the Forgen KEY of the PRINTER_ID (Parent KEY)

I want to show in the second GRID only the data that belong to selected printer
Kan somebody help me?

Thanks in advance
Dmitriy Utsmiyev

Sample code below

 @(Html.Kendo().Grid((IEnumerable<KendoUIMvcLoginApp.Models.Data.Printer>)ViewBag.Printers)
            .Name("grid")
            .Columns(columns =>
            {
                columns.Bound(e => e.PRINTER_NAME).Title("Printer Name");
                columns.Bound(e => e.PRINTER_IP).Hidden();
                columns.Bound(e => e.PRINTER_ID).Hidden();
                columns.Bound(e => e.PRINTER_MIB_ID).Hidden();
               
                columns.Command(command => command.Custom("Start").Click("showDetails")).Width(50);
            })
            .ClientDetailTemplateId("template")
            .DataSource(dataSource => dataSource
                .Ajax()
                .Read(read => read.Action("HierarchyBinding_Employees", "Grid"))
            )
            .Events(events => events.DataBound("dataBound"))
        )
   
        <script id="template" type="text/x-kendo-template">
            @(Html.Kendo().TabStrip()
                    .Name("tabStrip_#=PRINTER_ID#")
                    .SelectedIndex(0)
                    .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
                    .Items(items =>
                    {  
                        items.Add().Text("Test Counters").Content(@<text>
                            @(Html.Kendo().Grid((IEnumerable<KendoUIMvcLoginApp.Models.Data.Counter>)ViewBag.Counters)
                                .Name("grid_#=PRINTER_ID#")
                                .Columns(columns =>
                                {
                                    columns.Bound(o => o.COUNTER_NAME).Title("Name");
                                    columns.Bound(o => o.COUNTER_VALUE).Title("Value");
                                    columns.Bound(o => o.COUNTER_PRICE).Title("Price");
                                    columns.Bound(o => o.COUNTER_PRICE_TOTAL).Title("Total Price");
                                    columns.Bound(o => o.COUNTER_PRNITER_ID).Title("ID");
                                })
                                .DataSource(dataSource => dataSource
                                    .Ajax()
                                    .Read(read => read.Action("HierarchyBinding_Orders", "Grid", new { employeeID = "#=PRINTER_ID#" }))
                                    .Filter(filter => filter.Add(prod => prod.COUNTER_PRNITER_ID).IsEqualTo(decimal.Parse("# =PRINTER_ID#")))
                             )
                                .Sortable()
                                .ToClientTemplate())
                        </text>
                        );
                        items.Add().Text("Printer Information").Content(
                            "<div class='employee-details'>" +
                                "<ul>" +
                                    "<li><label>Printer:</label>#= PRINTER_NAME #</li>" +
                                    "<li><label>Ip address:</label>#= PRINTER_IP #</li>" +
                                    "<li><label>ID:</label>#= PRINTER_ID #</li>" +
                                    "<li><label>MIB:</label>#= PRINTER_MIB_ID #</li>" +
                                "</ul>" +
                            "</div>"
                        );
                    })
                    .ToClientTemplate())
        </script>        <script>
            function dataBound() {
                this.expandRow(this.tbody.find("tr.k-master-row").first());
            }
        </script>
         <script>
            function dataBound() {
                this.expandRow(this.tbody.find("tr.k-master-row").first());
            }
        </script>
        <style scoped="scoped">
            .k-detail-cell .k-tabstrip .k-content {
                padding: 0.2em;
            }
            .employee-details ul
            {
                list-style:none;
                font-style:italic;
                margin: 15px;
                padding: 0;
            }
            .employee-details ul li
            {
                margin: 0;
                line-height: 1.7em;
            }            .employee-details label
            {
                display:inline-block;
                width:90px;
                padding-right: 10px;
                text-align: right;
                font-style:normal;
                font-weight:bold;
            }
        </style>
Vladimir Iliev
Telerik team
 answered on 30 Jul 2013
13 answers
176 views
Hi there,

I have just installed KendoUI 2013.2.716 on a new machine. It previously had no version of KendoUI on it. I have installed the VS Extensions to allow MVC apps to be created from scratch including KendoUI. I am on VS2012 Version 11.0.60610.01 Update 3. I am running Windows 8 Pro. 

The problem is that Javascript is failing.

I have gone for the fresh install because that version of KendoUI is also failing on another machine that I attempted to upgrade, but I couldn't figure out why. So I decided to install a fresh install on a new machine and copy the files across, if it was all working. Unfortunately, it's not.

javascript-error-1.png shows an error that occurred immediately in kendo.all.min.js
javascript-error-2.png shows the next error that occurred in kendo.aspnetmvc.min.js
javascript-error-3.png shows the next error that occured in dynamic javascript. 

The head section is as follows:
    <head>
        <title>Home Page</title>
        <link href="/Content/Site.css" rel="stylesheet" type="text/css" />
        <link href="/Content/kendo/2013.2.716/kendo.common.min.css" rel="stylesheet" type="text/css" />
    <link href="/Content/kendo/2013.2.716/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />
    <link href="/Content/kendo/2013.2.716/kendo.default.min.css" rel="stylesheet" type="text/css" />
    <link href="/Content/kendo/2013.2.716/kendo.dataviz.default.min.css" rel="stylesheet" type="text/css" />
    <script src="/Scripts/kendo/2013.2.716/jquery.min.js"></script>
    <script src="/Scripts/kendo/2013.2.716/kendo.all.min.js"></script>
    <script src="/Scripts/kendo/2013.2.716/kendo.aspnetmvc.min.js"></script>
    <script src="/Scripts/kendo.modernizr.custom.js"></script>
</head>

Is this fixable? Otherwise I'm hoping to get hold of a starter MVC4 application that works with the latest KendoUI release.

Regards,
Tony










Tony
Top achievements
Rank 1
 answered on 30 Jul 2013
1 answer
1.5K+ views
Hello,
I've started playing with kendo and I got a problem with getting the data on the eventchanged... my code is

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <input id="comboBox" />
   
    <script>
        $(document).ready(function () {
            $("#comboBox").kendoComboBox({
                dataTextField: "text",
                dataValueField: "value",
                dataSource: [
                    { text: "Item1", value: "1" },
                    { text: "Item2", value: "2" }
                ],
                change: function (e) {
                    var combobox = $("#comboBox").data("kendoComboBox");
                      var selectedIndex = combobox.select();
                    alert(combobox.select().text);
                }
            });
        });

    </script>
</asp:Content>

How do I get the object I've selected? for now it's as imple text/value what if it's an object of type

text, value, additionalinfo?

Thanks
Dimiter Madjarov
Telerik team
 answered on 30 Jul 2013
1 answer
123 views
Hi,

I believe my experience below is a bug, in which case I can report it elsewhere if this is not the proper channel.

I'm currently creating a Menu with custom text in an absolutely-positioned context menu. Each item has a checkbox and a label. Everything works fine except clicking on the label does not alter the checkbox (no click/change event is fired on the checkbox). What's even weirder, is that while holding the mouse button down on the label, the checkbox changes to its active state, so the link between the two items is clearly made.

I believe this bug stems from the openOnClick and closeOnClick configurations, because with a simple test case of one item, the bug can only be reproduced by passing values to one or both of these parameters in the configuration object. Adding a child to this test case will always produce the bug (presumably because the configurations are set to their defaults internally).

Below is my server wrapper code and a client-side test case. Both exhibit the bug, although the subitem from the latter can be removed to result in correct functionality.
@(Html.Kendo().Menu()
            .Name("s-mapMenu")
            .Orientation(MenuOrientation.Vertical)
            .Direction(MenuDirection.Right)
            .OpenOnClick(false)
            .CloseOnClick(false)
            .BindTo((IEnumerable<MyModels.Event>)ViewBag.EventList, (Kendo.Mvc.UI.Fluent.NavigationBindingFactory<MenuItem> mappings) => mappings
                .For<MyModels.Event>(binding => binding
                    .ItemDataBound((item, e) =>
                    {
                        item.Text = "<input type=\"checkbox\" checked class=\"s-checkbox\" id=\"toggle-" + e.EventID + "\" /><label for=\"toggle-" + e.EventID + "\">" + e.Name + "</label>";
                        item.Encoded = false; // Need this in order to render item.Text as HTML
                    })
                    .Children(e => e.EventObjects.Where(obj => obj.ArchivedDate == null).OrderByDescending(obj => obj.LastUpdated))
                )
                .For<MyModels.EventObject>(binding => binding
                    .ItemDataBound((item, o) =>
                    {
                        item.Text = "<input type=\"checkbox\" checked class=\"s-checkbox\" id=\"toggle-" + o.EventObjectID + "\" /><label for=\"toggle-" + o.EventObjectID + "\">" + o.Name + "</label>";
                        item.Encoded = false; // Need this in order to render item.Text as HTML
                    })
                    .Children(o => o.EventObjects.Where(obj => obj.ArchivedDate == null).OrderByDescending(obj => obj.LastUpdated))
                )
            )
        )
<ul id="myMenu">
    <li>
        <input id="foo" type="checkbox" /><label for="foo">hello</label>
        <!-- Removing the interior list below removes the bug -->
        <ul>
            <li>child</li>
        </ul>
    </li>
</ul>
<script>
    $("#myMenu").kendoMenu();
</script>
If you know of any workarounds, I would greatly appreciate it, as right now I have to manually listen for click events on the label.

Thanks,
Jeff
Dimo
Telerik team
 answered on 30 Jul 2013
4 answers
119 views
I am new to the Kendo  UI framework and would like some assistance in setting up an application layout.

In looking at several ways of laying out an application, I have settled on the layout the Telerik team used on their current incarnation of TeamPulse, and would like some assistance on setting up a similar layout.I would like to implement:
  • content containers as seen in the application
  • pin/unpin navigation on the LHS and RHS
  • LHS menu, where clicking on Work, Plan Analyze, Settings, slides the menu over, exposes the sub-menu. I would also like to know if this menu can go more than two levels deep, as I would prefer this type of menu over a tree-type menu.
I realize some of this can all be done without Telerik controls, but since I am considering using the KendoUI components, I'd like some assistance on using them to generate this UI.

I have started to go through some good tutorials, and currently working on a SPA application that makes use of kendo.fx.  I'm guessing the slideInLeft/Right is what is used for the TeamPulse LHS menu.

Is there a tutorial around that explains how to setup a similar UI?

Assistance appreciated.
Jordan
Telerik team
 answered on 30 Jul 2013
2 answers
128 views
Hi,

I'm writing HTML helpers that will render different kinds of objects based on the helper parameters.
As our application is Kendo based, my Html helper should render say a kendo datePicker or a Kendo Numericbox.

I can easily render HTML but the kendo object are Helper-generated too so I'm wondering what would be the best way to achieve my goal ?
Fabien
Top achievements
Rank 1
 answered on 30 Jul 2013
2 answers
91 views
I am using "appendTo" to place the Window inside the form. I receive an array with checked values for "checkedNodes" from the TreeView after the postback in FormCollection, but their values are "undefined". The values seem to be binding fine on the client side since I can check that there with no problem.

@* ++++++ View ++++++ *@
@using (Html.BeginForm(null, null, FormMethod.Post, new { name = "frmFind", id = "frmFind" }))
{

@Html.LabelFor(m => m.Things)
@(Html.Kendo().Window()
    .Name("windowThings")
    .Title("Things")
    .Draggable()    
    .Actions(actions => actions
        .Minimize()
        .Maximize()
        .Close()
    ).Visible(false)
    .Resizable().Scrollable(true).Height(350)
    .Content(@<text>
                  @(Html.Kendo().TreeView()
                        .Name("treeThings")
                        .Checkboxes(checkboxes => checkboxes
                                                    .CheckChildren(true)
                        )
                        .DataTextField("Value")
                        )
              </text>)
 )
<span id="buttonOpenThings" class="k-button">Select Things</span>
<script type="text/javascript">
    $("#windowThings").kendoWindow({
        appendTo: "#frmFind"
    });
</script>
}

// ++++++ Controller ++++++
        [HttpPost]
        public ActionResult Index(FormCollection values) 
        {
            var checkedNodes = values["checkedNodes"]; // result is "undefined, undefined, undefined, [etc]"
            return View();
        }
Sean Mars
Top achievements
Rank 1
 answered on 29 Jul 2013
5 answers
3.2K+ views
How can I add a required field in edit/create mode?  I see that you can enable validation on the grid in the JS examples but I see no direct examples of doing this in the Complete for MVC examples/demos.  Essentially I have a drop down list for AdmissionMilestoneID and I want to make it required that the user clicks the drop down and picks a value.  I am having issues when setting a default value as it seems to keep triggering the create event after I add the record fully and go to edit a new row.  It tries to recreate the new record even though it was already created.  

@(Html.Kendo().Grid(Model.federationMilestones) 
.Name("AdmissionMilestones")   
.Columns(columns => {       
    columns.ForeignKey(p => p.AdmissionMilestoneID, Model.academicMilestones, "AdmissionMilestoneID", "MilestoneName")
        .Title("Milestone");
    columns.Bound(p => p.IsKeyMilestone);
    columns.Bound(p => p.RecieveReminders);
    columns.Bound(p => p.StudentRelativeDeadline);
})
.ToolBar(toolbar =>
{
    toolbar.Save();
    toolbar.Create();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Sortable()
.Reorderable(reorder => reorder.Columns(true))
.Resizable(resize => resize.Columns(true))
.DataSource(dataSource => dataSource
    .Ajax()
    .Batch(true)
    .ServerOperation(false)
    .Events(events => events.Error("error_handler"))
 
    .Model(model =>
    {
        model.Id(p => p.AdmissionMilestoneID);
        model.Field(p => p.MilestoneName).Editable(false);
        model.Field(p => p.FederationID).DefaultValue(Model.FederationID);
    })
    .Update("Editing_Update_Milestones", "Admin")
    .Create("Editing_Add_Milestones", "Admin")
)
)
Matthew
Top achievements
Rank 1
 answered on 29 Jul 2013
1 answer
221 views
Hi there,

After I simply copy/paste the updated css/js files into my MVC4 project and rebuild I start to receive really nasty runtime errors.


Such as this error when the CSS is updated

Exception of type 'System.OutOfMemoryException' was thrown.
Description: An unhandled exception occurred during
the execution of the current web request. Please review the stack trace
for more information about the error and where it originated in the
code.

Exception Details: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
Source Error:
Line 6: <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
Line 7: <meta name="viewport" content="width=device-width" />
Line 8: @Styles.Render("~/Content/kendo")
Line 9: @Styles.Render("~/Content/css")
Line 10:

Stack Trace:
[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.Text.StringBuilder.ToString() +35
System.String.Format(IFormatProvider provider, String format, Object[] args) +72
Microsoft.Ajax.Utilities.AjaxMinExtensions.FormatInvariant(String format, Object[] args) +44
Microsoft.Ajax.Utilities.CssScanner.ReportError(Int32 severity, CssErrorCode error, Object[] args) +76
Microsoft.Ajax.Utilities.CssScanner.GetString() +665
Microsoft.Ajax.Utilities.CssScanner.ScanString() +16
Microsoft.Ajax.Utilities.CssScanner.NextToken() +751
Microsoft.Ajax.Utilities.CssParser.NextToken() +17
Microsoft.Ajax.Utilities.CssParser.SkipSpace() +17
Microsoft.Ajax.Utilities.CssParser.ParseDeclaration() +441
Microsoft.Ajax.Utilities.CssParser.ParseDeclarationList(Boolean allowMargins) +90
Microsoft.Ajax.Utilities.CssParser.ParseDeclarationBlock(Boolean allowMargins) +348
Microsoft.Ajax.Utilities.CssParser.ParseRule() +586
Microsoft.Ajax.Utilities.CssParser.ParseStylesheet() +463
Microsoft.Ajax.Utilities.CssParser.Parse(String source) +528
Microsoft.Ajax.Utilities.Minifier.MinifyStyleSheet(String source, CssSettings settings) +248
System.Web.Optimization.CssMinify.Process(BundleContext context, BundleResponse response) +88

and additionally this error when the kendo js files are updated:

Server Error in '/' Application.

Length cannot be less than zero.
Parameter name: length

Description: An unhandled exception occurred during
the execution of the current web request. Please review the stack trace
for more information about the error and where it originated in the
code.
Exception Details: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length

Source Error:
Line 12:
Line 13: @Scripts.Render("~/bundles/jquery")
Line 14: @Scripts.Render("~/bundles/kendo")
Line 15: @Scripts.Render("~/bundles/knockout")
Line 16:

Stack Trace:
[ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length]
System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +10698969
Microsoft.Ajax.Utilities.JSScanner.ScanString(Char delimiter) +1395
Microsoft.Ajax.Utilities.JSScanner.ScanNextToken(Boolean scanRegExp) +246
Microsoft.Ajax.Utilities.JSParser.ScanNextToken() +33
Microsoft.Ajax.Utilities.JSParser.GetNextToken() +99
Microsoft.Ajax.Utilities.JSParser.SkipTokensAndThrow(AstNode partialAST) +50
Microsoft.Ajax.Utilities.JSParser.ParseLeftHandSideExpression(Boolean isMinus) +5271
Microsoft.Ajax.Utilities.JSParser.ParseUnaryExpression(Boolean& isLeftHandSideExpr, Boolean isMinus) +2065
Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean fSourceElement) +1595
Microsoft.Ajax.Utilities.JSParser.ParseBlock(Context& closingBraceContext) +195
Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean fSourceElement) +443
Microsoft.Ajax.Utilities.JSParser.ParseBlock(Context& closingBraceContext) +195
Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean fSourceElement) +443
Microsoft.Ajax.Utilities.JSParser.ParseIfStatement() +685
Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean fSourceElement) +485
Microsoft.Ajax.Utilities.JSParser.ParseBlock(Context& closingBraceContext) +195
Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean fSourceElement) +443
Microsoft.Ajax.Utilities.JSParser.ParseIfStatement() +685
Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean fSourceElement) +485
Microsoft.Ajax.Utilities.JSParser.ParseFunction(FunctionType functionType, Context fncCtx) +1615
Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean fSourceElement) +1250
Microsoft.Ajax.Utilities.JSParser.ParseFunction(FunctionType functionType, Context fncCtx) +1615
Microsoft.Ajax.Utilities.JSParser.ParseLeftHandSideExpression(Boolean isMinus) +5051
Microsoft.Ajax.Utilities.JSParser.ParseUnaryExpression(Boolean& isLeftHandSideExpr, Boolean isMinus) +2065
Microsoft.Ajax.Utilities.JSParser.ParseExpression(AstNode leftHandSide, Boolean single, Boolean bCanAssign, JSToken inToken) +738
Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean fSourceElement) +2113
Microsoft.Ajax.Utilities.JSParser.ParseStatements() +309
Microsoft.Ajax.Utilities.JSParser.Parse(CodeSettings settings) +133
Microsoft.Ajax.Utilities.Minifier.MinifyJavaScript(String source, CodeSettings codeSettings) +268
Atanas Korchev
Telerik team
 answered on 29 Jul 2013
6 answers
926 views
Hi,
my company purchased Kendo UI for ASP.NET MVC, and i'm trying to use this ToDataSourceResult() extension method in order to make the paging on server for the grid just like the example on the site ,but i cannot find the kendo.UI.extensions namespace,or at least i installed the kendo extensions for VS and no such namespace,only Kendo.MVC.dll ,also i downloaded the telerik extensions for asp.net mvc,but there is no such method in \Extensions directory. What should i have to do in order to use this method?

thanks in advanced.
Petur Subev
Telerik team
 answered on 29 Jul 2013
Narrow your results
Selected tags
Tags
+133 more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?