Telerik Forums
UI for ASP.NET MVC Forum
3 answers
183 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
132 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
553 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
198 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
100 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
122 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
192 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
1 answer
1.0K+ views
Hi guys,

It’s possible to make a control dropdownlist with settings cascade enabled and filtered by contains too. I show you the scenario:


Grid code

@(Html.Kendo().Grid<FareDetailViewModel>()
                            .Name("fare_details#=FareID#")
                            .ToolBar(t =>
                            {
                                if (User.IsInRole("Modify"))
                                {
                                    t.Create().Text("Afegir Referencia");
                                }
                            })
                            .Columns(columns =>
                            {
                                columns.ForeignKey(f => f.Tipus, (System.Collections.IEnumerable)ViewBag.CatalogTypes, "Key", "Value").EditorTemplateName("CustomGridForeignKeyFareType").Width(120);
                                //columns.ForeignKey(f => f.CatalogReference, (System.Collections.IEnumerable)ViewBag.Cataleg, "Reference", "Descripcio").EditorTemplateName("CatalegReferenceByType");
                                columns.Bound(f => f.CatalogReference).EditorTemplateName("CatalegReferenceByType").EditorViewData(new { gridid = "fare_details#=FareID#" });

Editor template

@model object
 
@(Html.Kendo().DropDownList()
    .Name("CatalogReference" + ViewData["gridid"])
    .HtmlAttributes(new { data_bind = "value:CatalogReference" })
    .AutoBind(false)
    .OptionLabel("Select reference...")
    .DataTextField("Descripcio")
    .DataValueField("Reference")
    .Filter(FilterType.Contains)
    .MinLength(3)
    .ValuePrimitive(true)
    //.HtmlAttributes(new { data_skip = "true", data_bind = "defferedValue: object" })
    //.BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])
    .DataSource(source =>
    {
        source.Read(read => read.Action("PopulateReferences", "Catalog").Data("filterTypes"))
            .ServerFiltering(true);
    })
    .CascadeFrom("Tipus")
    .HtmlAttributes(new { id = Guid.NewGuid().ToString() })
)

function filterTypes() {
            return {
                text: $("#Type").data("kendoDropDownList").value() + "|" + $("#CatalogReference" + temporalFare).data("kendoDropDownList").filterInput.val()
            };
        }


$("#CatalogReference" + temporalFare).data("kendoDropDownList") 
Here, I find the error.  Browser say me this expression is undefined

Controller Code

public JsonResult PopulateReferences(string text)
        {
            var param = text.Split('|');
            var type = (int)text[0];
            var search = text[1];
 
            var catalog = GetCatalog((catalogType)type).Where(c => (c.Descripcio + " " + c.Reference).Contains(search)).Select(c => new { Reference = c.Reference, Descripcio = c.Descripcio + " - " + c.Reference }).AsQueryable();
 
            return Json(catalog, JsonRequestBehavior.AllowGet);
        }

I hope this is helpful code.

 

 

Thanks in advance.



Xavier.




Alexander Popov
Telerik team
 answered on 06 Apr 2015
2 answers
182 views
Hello,

I have used Kendo with MVC projects, and quite like it. 

Part of my evaluation is how easy it would be to retrofit a couple grids into legacy code-behind projects. 

Can I use the .Net helpers? Or do I have to use the pure HTML/Javascript methods? 

Being an MVC guy, I have not sent JSON to/from on a code-behind project before... In MVC the JSON is automatically converted into your viewmodel type onthe backend, if you C# class aligns with the JSON data. Is the same possible with CodeBehind?

Is there a simple example of a kendo grid using .net code-behind?

Thanks,

~S
Michael
Top achievements
Rank 1
 answered on 05 Apr 2015
1 answer
241 views


The following dropdownlist will not ever select any item except for the first (index 0):

  var clientList = HtmlExtensionMethods.GetClients().Select(c => new SelectListItem { Text = c.Value, Value = c.Key }).ToList();

 @(Html.Kendo().DropDownListFor(model => model.ClientID)
    .Name("ClientID")
    .BindTo(clientList)
    .DataTextField("Text")
    .DataValueField("Value")
    .Value(Model.ClientID)
    .Text(Model.ClientName)
    .HtmlAttributes(new { @class = "select wfull" })
  )

I have tried removing the Value and Text methods and adding .SelectedIndex(2) which does not work either.  The model.ClientID is a value in the selectlistitem.  How in the world can I get this dropdown to select the item with the value from model.  Nothing seems to work.

 v2014.3.1314



Boyan Dimitrov
Telerik team
 answered on 03 Apr 2015
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?