Telerik Forums
UI for ASP.NET MVC Forum
5 answers
2.2K+ views
Is there anyway to provide default grouping when the grid is rendered on the view? For example, in the grid below, I want to group by Type, by default. Thanks.

@(Html.Kendo().Grid<SomeModel>()
        .Name("Grid")
        .Columns(columns =>
        {  
            columns.Bound(p => p.TYPE).Title("Type");          
            columns.Bound(p => p.NAME).Title("Name");
            columns.Bound(p => p.CITY).Title("City");
        })        
        .Sortable()
        .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(100)
                .Read(read => read.Action("GetInfo", "Summary"))
        )
.Groupable (// group by first column)
Raj
Top achievements
Rank 1
 answered on 03 Mar 2017
2 answers
145 views

I have an Ajax.BeginForm that contains a button that allows you to open an existing Window (outside of the beginForm).

When I call the window and refresh with a new url, no matter what url is used or what is displayed in it, after the window is refreshed it makes a post back to the server for the BeginForm.

navbarWindowURL = "google.com";
navbarWindowData.refresh({
    url: navbarWindowURL
}).center();

 

Is theresomething about calling this code that would cause the BeginForm to PostBack?

I know you usually like example code to demonstrate the issue, but it would be really difficult to provide an example at this time.

 

Ivan Danchev
Telerik team
 answered on 03 Mar 2017
3 answers
1.1K+ views

Hello,

I have created a kendo grid using the asp.net mvc wrappers and I want to add a selection capability. I am interested in selecting all the rows when a filter is made or not, without going through each page. More or less, I want to know if it is possible to make the selection on the server-side not on the client. I have looked through this example:http://dojo.telerik.com/@Stephen/EMeZE and it is not applicable in my case because I need to open each page and select all the rows. Is an other alternative?

Thank you very much!

Tsvetina
Telerik team
 answered on 02 Mar 2017
1 answer
125 views

I have a splitter with two windows, left holds a treeview, the right a partial view that depends on the selected node in the treeview to select the content (via an onSelect event).

The problem is that this code sometimes works perfectly and sometimes does not - specifically it renders the "parent" page (including the splitter, treeview etc) inside the right hand pane.

I'm a newbie with MVC, javascript etc so have no idea where the problem is - nor can I reproduce it at will.

The javascript snippit is:

function onSelect(e) {
        try {
            var treeView = e.sender;
            var text = treeView.text(e.node);
            var data = treeView.dataItem(e.node);
            var id = data.id;
            console.log(id, text);
            var parent = null;
            try {
               parent = treeView.text(e.node.parentNode);
            } catch (e) {
                console.log(e.message);
            }
            
            $("#splitter").kendoSplitter();
            var splitter = $("#splitter").data("kendoSplitter");

            switch (text) {
                case "Case":
                    splitter.ajaxRequest("#right-pane", "PartialCase", { id: id });
                    break;

 

And using the F12 debug I can follow it to the "splitter.ajaxRequest" line at which point it populates the right window with the parent page.

 

I hope this is something stupid.

 

Thanks

Veselin Tsvetanov
Telerik team
 answered on 02 Mar 2017
2 answers
514 views
Hello Telerik support team,

I have the latest Kendo UI MVC installed on my computer. I am using Visual Studio 2013 to develop ASP.NET MVC applications. 

I am currently looking for a way to make a menu on my application. I came across an article where I am able to bind the Menu control with a site map. I have that done in my application. Want I want to do now is make it work similar to how Bootstrap already does things. I know there is a post here on the forums where it says that you guys didn't have close integration with Bootstrap for the controls. That post was from last year and might or might not be relevant. 

I'm not sure if you guys are using the Kendo UI Menu in your website here: http://www.telerik.com/kendo-ui
But if you are I would like to know how you guys are making that 3 bar icon to show up when you resize the window. That is something that I am looking for.

Thank you,
David
Carlos
Top achievements
Rank 1
 answered on 01 Mar 2017
1 answer
82 views

Kendo version: 2015.1.429

We got an IndexOutOfRangeException error as attached.  Please advise.

Thanks

 

 

Ivan Danchev
Telerik team
 answered on 01 Mar 2017
1 answer
303 views

I'm quite confused as to when I need to prefix my row data with "data." versus when I don't.

For instance, the example on the FAQ never mentions that you need to prefix "Enable with "data." (i.e. "data.Enabled") to access the Enabled field. But in my code if I don't do "data.Enabled" I get an undefined error.

But, if I do something like

#= fieldName != null  ?  kendo.toString(fieldName)  :  '' #

I don't have to do data.fieldName. Also, many example I find in the forums sometimes include data. and other times they dont. Is there some place I can look at that tells me when I need to use "data." and when I don't?

 

 

 

Boyan Dimitrov
Telerik team
 answered on 28 Feb 2017
1 answer
510 views

I have a hierarchical grid, using MVC, and in the detail (child) table, I want the user to be able to create a new row and the row will contain an Autocomplete field. I have everything wired up, the grid displays correctly, with data. When the user clicks Add New Record, a new row is displayed with the Autocomplete field. However, for some reason, no data is being retrieved from the server (the controller method isn't getting called at all) when the user starts typing. Here is the code for the autocomplete editor and the detail table:

@(Html.Kendo().AutoComplete()

          .Name("Combined")
          .ValuePrimitive(true)
          .DataTextField("Combined")
          .Filter("contains")
          .MinLength(3)
          .HtmlAttributes(new { style = "width:200px" })
          .DataSource(source =>
          {
              source.Read(read =>
              {
                  read.Action("GetAntiqueCategories", "Customer");
              })
              .ServerFiltering(false);
          })
)

<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<Entities.AntiqueCategory>()
            .Name("grid_#=RowId#")
            .Columns(columns =>
            {
                columns.Bound(o => o.Combined).EditorTemplateName("Combined");
                columns.Command(command => { command.Destroy(); }).Width(200);
            })
            .ToolBar(toolbar =>
            {
                toolbar.Create();
                toolbar.Save();
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(10)
                .Model(model => model.Id(p => p.RowId))
                .Read(read => read.Action("ReadCustomerWantDetail", "Customer", new { customerId = "#=RowId#" }))
                .Create(update => update.Action("CreateCustomerWantDetail", "Customer", new { customerId = "#=RowId#" }))
                .Update(update => update.Action("CreateCustomerWantDetail", "Customer", new { customerId = "#=RowId#" }))
                .Destroy(update => update.Action("DeleteCustomerWantDetail", "Customer"))
            )
            .Editable(editable => editable.Mode(GridEditMode.InCell))
            .Pageable()
            .Sortable()
            .ToClientTemplate()
    )
</script>

Tsvetina
Telerik team
 answered on 28 Feb 2017
1 answer
591 views

Hello,

I need to validate user input for ipv4 adress. I am using maskedtextbox. How can i set mask property of maskedtextbox?

I write this code but it doesn't work. ?

<body>
 
<input id="maskedtextbox" />
<script>
$("#maskedtextbox").kendoMaskedTextBox({
    mask: "~",
    rules: {
        "~":((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
    }
});
</script>
</body>

Viktor Tachev
Telerik team
 answered on 28 Feb 2017
9 answers
333 views
Hello,

we have Hierarchical DataSource with multilevel and with dynamic images. So ned to load only the parent nodes first and clicking on each node should call back controller method and load children on Onselect event. I am facing the following problem.
1-First i tried to implement a read method like remote datasource binding and loaded the parents nodes , but then it will not display anything.
@(Html.Kendo().TreeView()
    .Name("treeview")
    .HtmlAttributes(new {@class="demo-section" })
    .DataTextField("Text")
    .DataSource(dataSource => dataSource
        .Read(read => read
            .Action("ReadObjects", "TreeView")
        )
    )
 public JsonResult ReadObjects()
        {

            List<TreeViewItemViewModel> result = new List<TreeViewItemViewModel>();
           

           
            return Json(result, JsonRequestBehavior.AllowGet);
        }

2. So i tried the other option to bind and it displays the root level. But how do i load children on select event?
@(
        Html.Kendo().TreeView()
            .Name("treeview")
            //.DataSpriteCssClassField("spriteCssClass")
             .HtmlAttributes(new {@class="demo-section" })
             .Events(events => events
        .Select("onSelect")    
    )
            .BindTo((IEnumerable<TreeViewItemModel>)ViewBag.inlineDefault)
    )

Is there a sample in mvc to refer. Also when i set imageURL it is not showing images.

Thanks

Anamika
Mark
Top achievements
Rank 1
 answered on 27 Feb 2017
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?