Telerik Forums
UI for ASP.NET MVC Forum
3 answers
135 views
May have found a bug, or at least it was unexpected behavior for me.

@(Html.Kendo().TabStrip()
    .Name("tabStrip")
    .Items(tabs =>
             {
                  tabs.Add().Text("Tab1").Content(@<text>some content</text>).Selected(true);
                  tabs.Add().Text("Tab2").LoadContentFrom("Action", "Controller");
             })
)


If I am on "Tab2" and click "Tab1" but quickly click back to "Tab2" before the animation is complete it loads my partial view (from the controller action) outside of the tabstrip and overwrites the page content. I was able to reproduce with the default animation set up.

Kamen Bundev
Telerik team
 answered on 01 Oct 2013
4 answers
396 views
Hi,

I have a Master Detail Grid in Kendo UI

I want to add rows to Detail Grid with a Foriegn Key Column that is driven by Master Id, how do i accomplish this ?

I have highlighted the Foreign Key Column in bold

@(Html.Kendo().Grid<PackageModel>()
            .Name("RGrid")
            .Columns(col =>
            {
                col.Bound(c => c.Name).Visible(true);
                col.Bound(c => c.PackageName).Visible(true).Title("Package");                               
            })
            .DataSource(ds => ds
                .Ajax()
                .Events(e => e.RequestStart("onDataRequestStart"))
                .Model(m =>
                {
                    m.Id(c => c.OId);
                })
                .Read(read => read.Action("ReadPackages", "RGrid", new { area = "Recommendation", gridSettings = "##settings##" }))                
            )                        
            .ClientDetailTemplateId("recostemplate")
            .Navigatable()
            .Pageable(p => p.PageSizes(true))
            .Filterable()
            .Sortable()
            .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
        )



<script id="recostemplate" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<SE.OrderBook.Web.Models.View.RecommendationModel>()
                .Name("RecosGrid#=Id#")
                .Columns(columns =>
                {
                    columns.Bound(o => o.Id).Title("Id").Visible(true);
                    columns.ForeignKey(o => o.DeliverableId, commonService.GetDeliverableDropList(), "Id", "Value");
                    columns.Bound(o => o.DeliverableName).Title("Deliverable").Visible(true);
                    columns.Bound(o => o.Included).Visible(true);
                    columns.Bound(o => o.ServiceStart).Format("{0:d}").Title("Service<br />Start");
                    columns.Bound(o => o.ServiceEnd).Format("{0:d}").Title("Service<br />End");                    
                    columns.Bound(o => o.Year1).Visible(true);
                    columns.Bound(o => o.Total).Visible(true);
                    columns.Bound(o => o.PackageId).Hidden(true);
                    columns.Command(cmd => { cmd.Edit().UpdateText("Save"); /*cmd.Destroy();*/ }).Visible(true).Width("10%");                    
                })
                .DataSource(ds => ds
                    .Ajax()
                    .PageSize(5)
                    .Model(m =>
                    {
                        m.Id(c => c.Id);
                        m.Field(c => c.PackageId).DefaultValue("#=Id#");
                    })
                    .Read(read => read.Action("Read", "Home", new { area = "Recommendation", id = "#=Id#" }))
                    .Create(update => update.Action("Create", "Recos", new { area = "Recommendation" }))
                    .Update(update => update.Action("Update", "Recos", new { area = "Recommendation" }))
                    .Destroy(delete => delete.Action("Delete", "Recos", new { area = "Recommendation" }))
                )
                .ToolBar(toolbar => { toolbar.Create(); })
                .Events(events =>
                {
                    events.Edit("onRecoDetailsEdit");
                    events.Save("onRecoDetailsSave");
                })
                .Editable(e => e.Mode(GridEditMode.PopUp))
                .Pageable()
                .Sortable()
                .ToClientTemplate())
</script>


I need to pass package Id into commonService.GetDeliverableDropList() but i am not sure how to accomplish this?

I think solution to this is only possible at run time through AJAX, if particular than is there an example how i can populate foriegn key colum dropdown list through AJAX ?

Waiting for Response,

Kind Regards,




Taha
Top achievements
Rank 1
 answered on 01 Oct 2013
2 answers
264 views
This is a weird problem.  The issue occurs only occasionally.  There is an image file in the "~/Content/textures/" directory called "highlight.png" (a Kendo UI file).  Occasionally when I try to create a new "Event" in the Scheduler I will get a 500 error.  Here is the message:

"NetworkError: 500 Internal Server Error - http://mywebsite.azurewebsites.net/error/Error?aspxerrorpath=/Sessions/textures/highlight.png"

You can see it is looking for the file in "~/Sessions/textures/".  This is wrong!  The "Sessions" component is the controller where this is being execute but the file is actually in "~/Content/textures/".  Yes, I have the folder and file included in the VS 2012 project.  Another time I got a "404 Not Found" for the same file with the bad path when I looked inside the NET tab of Firebug in the "GET highlight.png" trace.  This also succeeds with the right path sometimes.

Does this make any sense to anyone?  How could this get the wrong path half the time?
Entilzha
Top achievements
Rank 2
 answered on 01 Oct 2013
3 answers
447 views
Please tell me the way to bind the tree view using data source.
I am using the below code to bind the tree view,I am not  sure I am on the right track.


@(Html.Kendo().TreeView()
    .Name("treeview").DataTextField("Name")
    .DataSource(dataSource => dataSource
        .Read(read => read
            .Action("GetFolderTreeData", "Dashboard")
        )
    ) 
    
    
)
Atanas Korchev
Telerik team
 answered on 30 Sep 2013
1 answer
45 views
Hello,

I am calling a Window that populates using a Controller Action Partial View.   My window will contain cascading dropdowns.  If I add a serverfiltering with a datafilter to my datasource I get a javascript error saying it can't find said method.   When I remove the filter the box populates but Autocomplete doesn't work properly.    If I change it to clientside filtering it works fine but I need to be able to add a group filter.     Is Server filtering not available inside a Window control ?

I prepared a sample project to illustrate the problem. 

Thanks,
Carrie
Petur Subev
Telerik team
 answered on 30 Sep 2013
1 answer
53 views
Hi all,

Since last week, the online demo for all Kendo UI pages are not able to display in IE, Chrome and firefox, sample page:

http://demos.kendoui.com/web/listview/index.html

the console shows there has many JS syntax errors, I want to show those sample to my colleagues but seems all pages are not working, is there anyone also has the same problem?

Michael
Atanas Korchev
Telerik team
 answered on 30 Sep 2013
3 answers
95 views
I have implemented Kendo MVC Upload to our ASP.NET MVC 4.0 web app. Unfortunately we get many  dropped uploads. 

The upload method is executed but it contain empty file list and Request.ContentLengh and Request.TotalBytes do not match. Do you have any idea why this happens?

 [HttpPost]
public ActionResult UploadFile(IEnumerable<HttpPostedFileBase> clientUpload, [OptionModelBinder]IOptionViewModel formData)
{
//our action
}

T. Tsonev
Telerik team
 answered on 27 Sep 2013
3 answers
103 views
Hi,
I am trying add tabs into an existing tabstrip and it works as expected. But when the number of tabs increase it goes to the second line. Is there a feature that will place the tabs on the same line.
Thanks in advance
Dimo
Telerik team
 answered on 26 Sep 2013
1 answer
1.1K+ views
I would like to be able to map a DataSourceResult to a ViewModel in my controller class, is this possible?

I have a pretty normal MVC application with a ViewModel
public class UserViewModel
   {
       public UserViewModel()
       {
           WebSiteUsers = new List<WebSiteUser>();
       }
       public List<WebSiteUser> WebSiteUsers { get; set; }
   }
 
   public class WebSiteUser
   {
       public int UserId { get; set; }
       public string Username { get; set; }
       public string FirstName { get; set; }
       public string LastName { get; set; }
   }

And a normal Grid in razor
@(Html.Kendo().Grid<Views.Users.ViewModel.WebSiteUser>()
    .Name("Grid")
    .Columns(columns =>
        {
            columns.Bound(p => p.UserId);
            columns.Bound(p => p.Username);
            columns.Bound(p => p.FirstName);
            columns.Bound(p => p.LastName);
        })
         
        .Pageable(p => p.PageSizes(true))
     .HtmlAttributes(new { style = "height:500px;" })
     .DataSource(dataSource => dataSource
         .Ajax()
         .PageSize(20)
         .Model(model => model.Id(p => p.UserId))
         .Read(read => read.Action("Users_Read", "Users"))
     )
 
)
My controller has the following action for AJAX binding for filtering.

public ActionResult Users_Read([DataSourceRequest]DataSourceRequest request)
       {
           DataSourceResult result = _user.GetSiteUsersKendo(request);
 
           return Json(result);
       }

My service class has the method for getting the users.
public DataSourceResult GetSiteUsersKendo([DataSourceRequest]DataSourceRequest request)
       {
           using (TestEntities context = new Models.TestEntities())
           {
               IQueryable<Models.WebSiteUser> webSiteUsers = context.WebSiteUsers;
 
               DataSourceResult result = webSiteUsers.ToDataSourceResult(request);
 
               return result;
           }
       }

This code returns a Javascripts serialisaztion error - Object connection closed. I presume this is because the JSON call in the controller is trying to serialise the entity framework object perhaps trying to perform some kind of lazy loading but of course the connection to the DB is closed as it's in a 'Using' statement.

What I'm trying to achieve is a way to return a ViewModel to the grid from the controller action. 

I can force the DataSourceResult to map to a POCO using the following code in my service class. I do NOT want to use a ViewModel in my service class, only the controllers should be aware of the ViewModels.
DataSourceResult result = webSiteUsers.ToDataSourceResult(request, su => new Models.UserModels.WebSiteUser{
                    UserId = su.UserId,
                    Username = su.Username
                });
But then I still need to map the DataSourceResult to a ViewModel in the controller.

Is this possible?






Petur Subev
Telerik team
 answered on 26 Sep 2013
3 answers
77 views
I have few grids and I do filtering and reduce the standard operators. Code below.
I also use the Swedish language. However all the standard operators show up for the columns. (Extra(false) works)
When I remove the Kendo.Mvc.resources.dll everything works as expected.
The version of the dll is 2013.2.918.340 and I have the same version for the Kendo.Mvc.dll
The translations works fine when the resources are available but I like to reduce the operators.
Is this a bug? 
.Filterable(filterable => filterable
            .Extra(false)
            .Operators(operators => operators
                .ForString(str => str.Clear()
                    .Contains("InnehÃ¥ller")
                         .StartsWith("Startar med")
                    .IsEqualTo("Är lika med")
Dimiter Madjarov
Telerik team
 answered on 26 Sep 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?