Telerik Forums
UI for ASP.NET MVC Forum
1 answer
448 views
Hi,

I have a grid of records that are editable (popup). 

When I click edit and launch the popup editor template I have another grid that is populated by passing a value to a controller method. I'm trying to access this value from the ViewModel that the original selected record is built from.

I understand the editor template serialization and there has been a similar question posted here: http://www.telerik.com/forums/model-not-initialized-in-grid-popup-editor-

Does anyone know how to access the bound data from within a template?

Regards
Petur Subev
Telerik team
 answered on 30 Apr 2014
4 answers
496 views
I upgrade my kendo UI for MVC to 2014.1.415

I want to add rule to the masked text box.  So I copied the example from this page:
http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/maskedtextbox/overview

Here is my view:
--------------------
@{
    ViewBag.Title = "MaskedTextWithRule";
}

<h2>MaskedTextWithRule</h2>


<div class="demo-section">
    <h2>Mask Input </h2>
    <ul id="fieldlist">
        <li>
            <label for="phone_number">Phone number:</label>
            @(Html.Kendo().MaskedTextBox()
                  .Name("phone_number")
                  .Mask("(999) 000-0000")
                  .Value("555 123 4567")
            )
        </li>

        <li>
            @(Html.Kendo().MaskedTextBox()
                  .Name("maskedtextbox")
                  .Rules(rules => {
                      rules.Add("~", "/[+-]/");
                  })
                  .Mask("~0000") //Set a mask with custom rule
            )
        </li>

    </ul>
</div>

<style>
    .demo-section {
        width: 300px;
        margin: 35px auto 50px;
        padding: 30px;
    }

    .demo-section h2 {
        text-transform: uppercase;
        font-size: 1.2em;
        margin-bottom: 10px;
    }

    #fieldlist
    {
        margin:0;
        padding:0;
    }

    #fieldlist li
    {
        list-style:none;
        padding:10px 0;
    }

    #fieldlist label {
        display: inline-block;
        width: 130px;
        margin-right: 5px;
        text-align: right;
    }
</style>

---------------------------------------------------

I compiled the project without problem, but when I run it, I got the following error
--------------------------------------------
Server Error in '/' Application.Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1502: The best overloaded method match for 'Kendo.Mvc.UI.Fluent.MaskedTextBoxRulesBuilder.Add(char, string)' has some invalid arguments

Source Error:

Line 22: .Name("maskedtextbox")
Line 23: .Rules(rules => {
Line 24: rules.Add("~", "/[+-]/");
Line 25: })
Line 26: .Mask("~0000") //Set a mask with custom rule


Dongfen
Top achievements
Rank 1
 answered on 29 Apr 2014
2 answers
361 views
Message: Exception: System.InvalidCastException: Unable to cast object of type 'Kendo.Mvc.CompositeFilterDescriptor' to type 'Kendo.Mvc.FilterDescriptor'.
   at Kendo.Mvc.Infrastructure.Implementation.FilterNodeVisitor.Visit(PropertyNode propertyNode)
   at Kendo.Mvc.Infrastructure.Implementation.OrNode.Accept(IFilterNodeVisitor visitor)
   at Kendo.Mvc.UI.DataSourceRequestModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor)
   at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
Grahame
Top achievements
Rank 2
 answered on 29 Apr 2014
3 answers
99 views
I use latest Telerik release (423) and get different rendering of the ddList in a project. First I thought I had done something wrong, this could happen sometimes. However I started a new project with the Telerik mvc5 template and got same result.
Theme bootstrap.
IE and firefox and Safari ok Chrome not so good.(latest versions)

Jan Olsmar
Top achievements
Rank 1
 answered on 29 Apr 2014
2 answers
297 views
Hello

My code is based on this thread:
http://www.telerik.com/forums/multiple-row-selection-without-holding-ctrl-key

I have a grid:
01.@(Html.Kendo().Grid(Model.globalConfigData.Countries)
02.      .Name("CountryFilter")
03.      .Columns(columns =>
04.               {
05.                   columns.Bound(p => p.value).Width(100).Title("Wert").HtmlAttributes(new { Name = "Value" });
06.                   columns.Bound(p => p.id).Width(30).Title("Id").Hidden().HtmlAttributes(new { Name = "Id" });
07.               })
08.      .Scrollable()
09.              .Selectable(selectable => selectable.Enabled(false))
12.      .DataSource(dataSource => dataSource
13.          .Server()
14.          .Model(model => model.Id(p => p.id)))
15.)

With the custom-multiselect configured:
1.$(document).ready(function ()
2.{
3.    // Enables multiselect on the grid without holding CTRL
4.    $("#CountryFilter").delegate('tbody>tr', 'click', function ()
5.    {
6.        $(this).toggleClass('k-state-selected');
7.    });
8.});

And then a function which is fired by a button:
01.function onClick_FilterButton(e)
02.{
03.    var counter = 0;
04.    var ctySelected = [];
05. 
06.    var entityGrid = $("#CountryFilter").data("kendoGrid");
07.    var rows = entityGrid.select();
08. 
09.    rows.each(function (index, row)
10.    {
11.        ctySelected[counter] = row.cells[1].innerText;
12.        counter++;
13.    });
14. 
15.    $.ajax({
16.        type: "POST",
17.        url: "/Event/FilterButton",
18.        datatype: "json",
19.        traditional: true,
20.        data: { "ids": ctySelected }
21.    });
22.}

Now to my problem:
When I use the normal selection mode of the Kendo-Grid (selectable.Mode(GridSelectionMode.Multiple)), the onClick-function works fine, but when I activate the custom multiselect-mode, the function crashes at line 7 (entityGrid.select() => value is Null or undefined)

How can I get the selected rows when I use this functionality?

A second (not urgent) question:
1.ctySelected[counter] = row.cells[1].innerText;

Is it possible to get the cell by it's name, like:
1.ctySelected[counter] = row.cells["MyValue"].innerText;

Kind regards
Jürgen
Jürgen
Top achievements
Rank 1
 answered on 29 Apr 2014
5 answers
275 views
I'm loading dropdown items like the example for cascading dropdowns.  I can see the correct JSON returned from the server in Fiddler, so I know my methods are correct and the controller is returning data.   The spinning icon still shows.  I've tried to reduce my recordset, there's only about 75 or so returned.  Nothing has worked so far.  any ideas?
Patrick
Top achievements
Rank 1
 answered on 29 Apr 2014
1 answer
42.6K+ views
Hi,

I want to mask Indian cell phone number like +91xxxxxxxxxx .
It is showing +_1__________ instead of +91__________

Please suggest how to do?

Find the attached image for my code and output of screen.

Thanks & Regards,
Bharat
Dimiter Madjarov
Telerik team
 answered on 29 Apr 2014
1 answer
455 views
I'm just getting started with UI for ASP.Net MVC and have been looking for an example on how use BootStrap and Telerik together in a MVC4 project. Have not found any examples. Does anyone know where I might find some. I want to use Bootstrap for my Layout page, and Telerik for UI Controls and widgets. Thanks
Dimo
Telerik team
 answered on 28 Apr 2014
5 answers
146 views
Hi,
I am trying to load a grid from a search button, and it is working great in my view. Then this grid has a nested grid. The nested grid should have a button that upon selected gets a column from the parent grid and a column from the child grid and redirect to a different view (controller action).

Parent grid:
@(Html.Kendo().Grid(Model.Names)
                        .Name("gridPatients")
                        .Columns(col =>
                        {
                            col.Bound(m => m.NAME_FIRST).Title("First Name");
                            col.Bound(m => m.NAME_LAST).Title("Last Name");
                            col.Bound(m => m.SEX).Title("SEX");
                            col.Bound(m => m.DOB).Title("DOB");
                            col.Bound(m => m.MRN).Title("MRN");
                            col.Bound(m => m.PERSON_ID).Title("Person ID").Hidden();
                        })
                        .Pageable()
                        .Sortable()
                        .ClientDetailTemplateId("TheVisits")
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(10)
                            .ServerOperation(false)
                            )  
                    )

Child Grid:
@(Html.Kendo().Grid(Model.PatientVisitsModel.ENCOUNTERS)
                .Name("grid_#=PERSON_ID#")
                .Columns(col =>
                {
                    col.Bound(m => m.FIN).Title("FIN");
                    col.Bound(m => m.BEG_EFFECTIVE_DT_TM).Title("Admit Date");
                    col.Bound(m => m.LOCATION).Title("Location");
                    col.Bound(m => m.STATUS).Title("Status");
                    col.Command(c => c.Custom("Select").Click("DirectToPdfCreator(#=PERSON_ID#)"));
                })
                     .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(5)
                    .Read(read => read.Action("_TheVisits", "PatientSearch", new { PERSON_ID = "#=PERSON_ID#" }))
                )
                .Pageable()
                .Sortable()
                .ToClientTemplate()               
        )

The problem is whenever I click on the arrow to load child grid, it automatically calls the js function "DirectToPdfCreator" even though I didn't click on the select button in the child grid. Please advice and thanks in advance.

Shehab
Petur Subev
Telerik team
 answered on 28 Apr 2014
3 answers
160 views
After the most recent release of the Kendo MVC wrapper, I noticed a new config option (HighlightPath(boolean)) for the tabstrip builder.  The basic description given is to select an item depending on the current URL.  However, I haven't been able to locate anything in the API documentation that expands on this to explain what the URL format should be, how to set it, etc.  Is there something I am missing?
Daniel
Telerik team
 answered on 28 Apr 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
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
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?