Telerik Forums
UI for ASP.NET MVC Forum
2 answers
190 views
I have a question about Kendo Grid for ASP.NET MVC.  It's probably something that I'm not doing incorrectly.

When I add a new item to the grid, I'm using the solution described on this forum post to move the inserted <tr> to the bottom of the grid.  That part works fine.  However, when I save the changes to the grid or add a new item, the inserted item is moved to the top of the grid, even if that breaks the currently applied sort order.

I have attached a simple project that demonstrates this.  To repro what I'm talking about, do the following:
  1. Run the app
  2. Note that the grid is currently sorting on the Id column in ascending order
  3. Go to the last page
  4. Click the "Add New Item" 
  5. Set the Id to 550 and enter First Name, Last Name, and Position
  6. Click "Save Changes" or "Add New Item"
  7. The inserted row that was at the bottom of the grid has been moved to the top, ignoring the sort order
Can anyone point out what I'm doing wrong?

Thanks
David
Top achievements
Rank 1
 answered on 30 Jan 2013
3 answers
73 views
I am using a grid to edit a table that is one column and that column is the primary ID. Therefore, I cannot edit the column. I want to allow adds and deletes (with checks in the background). There are two problems. I do not see the Add or Delete button in line. If I use the pop-up option, I can only add but the pop-up button states that I am editing, which would be confusing to the users. How do I get the grid to add and delete properly?

This is what I have:
@(Html.Kendo().Grid<NatureOfStudyViewModel>()
    .Name("NatureOfStudyGrid")
    .Columns(columns =>
        {
           columns.Bound(item => item.NatureOfStudy);            
        })
        .DataSource(ds => ds
            .Ajax()
            .Model(model =>
            {
                model.Id(m => m.NatureOfStudy);
            })
            .Read(read => read.Action("NatureOfStudyDataSource", "Lists"))
            .Create(create => create.Action("NatureOfStudyCreate","Lists"))
            .Destroy(destroy => destroy.Action("NatureOfStudyDelete","Lists"))
            .Events(events => events.Error("listValueDataSource_error"))
        )
    .Pageable()
    .ToolBar(commands => commands.Create())
    .Editable(edit => edit.Mode(GridEditMode.PopUp))
    )


 

 

 

 

 

 

 

 

 

 

 

 


Dimiter Madjarov
Telerik team
 answered on 30 Jan 2013
1 answer
81 views
I have an MVC4 app and I'm trying to evaluate the trial version of Kendo for MVC.  I want to add a grid to an existing edit page for on of my views.  We are using entity framework and views were made using the Razor view engine.  On this edit view page the data that is editable is from a tabled called Agency.  I want to add a grid to this razor view that will contain records from a tabled called Institute.

I have tried the AJAX binding example and the server binding example located here: http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/ajax-binding but neither of these seem to work in my existing application.

How do I accomplish this?
Don
Top achievements
Rank 1
 answered on 29 Jan 2013
2 answers
466 views
Hi, I would like to show relevant expanded data in a grid when user clicks on pie chart. Does charts provide any built in client events that get raised when chart area is clicked or do I have to hook it manually in jquery.
Dimiter Madjarov
Telerik team
 answered on 29 Jan 2013
1 answer
140 views
Hi,

I have a DropDownList which is populated with many items (around 15000). I know this is a lot, but it is needed for this application.

Unfortunately, the DropDownList does not open anymore, when there are that many items. The open Animation is shown but the Dropdown is closed immediately. I'm using the Version 2012.3.1114.

Is there a fix to this?

Greets
Dimiter Madjarov
Telerik team
 answered on 29 Jan 2013
1 answer
204 views

Specs

Kendo: 2012.3.1114
Net: 4.5
MVC: 4.0

Problem
I am binding my grid using a DataTable as the Model and need to have aggregate values.  I have to use the datatable as I have a lot of data that is being sent over from the web service.  If wrapped as XML it was over 55 MB for 21 columns and 14,400 rows so we converted the SQL DataTable to CSV and then sent the string over.  That resulted in a file around 5MB.

The data that I a getting has no model as there can easily be 200+ columns depending on the query so making a data model is sadly out of the question.

If I use the snippet below as my base (taken from the Kendo UI Code Library) there seems to be no way to set up the aggregate functions

@(Html.Kendo().Grid(Model)
    .Name("Grid")    
    .Columns(columns => {
        foreach (System.Data.DataColumn column in Model.Columns)
        {
            columns.Bound(column.DataType, column.ColumnName);
        }
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .Groupable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("Read", "Home"))   
    )
)

Back in the days of the Telerik MVC controls I could set up the aggregate function you could setup the aggregate while adding the bound column but in the Kendo UI wrapper that has been moved down to be inside of the DataSource.

Telerik Grid:

columns.Bound("ColumnName").Aggregate(aggregates => aggregates.Count().Min().Max())

If I try and set up the agregate down in the DataSource I get a lovely exception "'count' is undefined" which is a bit vague.

if (column.ColumnName == "ProductID")
{
 columns
  .Bound(column.DataType, column.ColumnName)
  .ClientFooterTemplate("Count: #=count#");
}
...
.Aggregates(aggregates =>
{
aggregates.Add(a => "ProductID").Count();
})


Is there any way to get around the aggregate problem?

Dimiter Madjarov
Telerik team
 answered on 29 Jan 2013
1 answer
70 views
Hi,

In Grid MVC Server Wrapper for Kendo UI, popup save values are not binding to grid for input text box. Same is happening for Date time selector, it works okay if a Date is selected but doesn't work consistently if someone manually types in a Date

Please see attached file for visual description

This only happens on IE8


Please suggest a solution

Thanks,

Taha

Daniel
Telerik team
 answered on 29 Jan 2013
1 answer
1.2K+ views
I've got a grid that I'm creating using the MVC wrapper.  I have fields defined as numeric but when I edit the fields they show a large textbox (not sure why they are so large) and never a numeric box.  I have found that when I add a client template that is a numeric text box the box shows up but doesn't appear with proper styling.  When I edit and cancel the box suddenly shows proper formatting.  I've looked at the HTML document and it seems that the wrapper objects are not being added.  I'm not sure what I'm doing wrong.  

Here is my MVC view code:
@(Html.Kendo().Grid<eLuminate.Radar.Web.Provider.Model.Procedures.Price>().Name("prices").Columns(columns =>
    {
        columns.Bound(c => c.Name).Width(250);
        columns.Bound(c => c.RelatedProviderName).Title(Model.IsFacility ? "Professional" : "Facility").Width(150);
        columns.Bound(c => c.High).Format("{0:C0}").Groupable(false).Filterable(false).Width(75).Hidden();
        columns.Bound(c => c.Low).Format("{0:C0}").Groupable(false).Filterable(false).Width(75).Hidden();
        columns.Bound(c => c.Average).Format("{0:C0}").Groupable(false).Filterable(false).Width(75);
        columns.Bound(c => c.MyPrice).Format("{0:C0}").Filterable(false).Width(125)
            .ClientTemplate(Html.Kendo().NumericTextBox().Name("mp_#=ID#").Min(0).HtmlAttributes(new { value = "#=MyPrice#", style = "width: 100px;" }).ToClientTemplate().ToHtmlString());
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Resizable(r => r.Columns(true))
    .Filterable()
    .ColumnMenu()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(false)
        .Events(events => events.Error("error_handler"))
        .Model(m =>
        {
            m.Id(p => p.ID);
            m.Field(p => p.Name).Editable(false);
            m.Field(p => p.RelatedProviderName).Editable(false);
            m.Field(p => p.High).Editable(false);
            m.Field(p => p.Low).Editable(false);
            m.Field(p => p.Average).Editable(false);
        })
        .Update(update => update.Action("UpdatePrice", "Procedures", new { id = Model.ID }))
        .Read(read => read.Action("ReadPrice", "Procedures", new { id = Model.ID }))
        .Destroy(destroy => destroy.Action("DeletePrice", "Procedures", new { id = Model.ID }))
        .Create(create => create.Action("AddPrice", "Procedures", new { id = Model.ID }))
    )
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Selectable()
    .ClientDetailTemplateId("analytics")
    .Groupable()
    .HtmlAttributes(new { style = "width: 800px;" }))
Daniel
Telerik team
 answered on 29 Jan 2013
2 answers
207 views
I've got several dropdown lists in an editor template, for use with a grids pop-up edit window.

They are displayed fine, and if a value other than the default one is selected, data is returned to the controller.

However, if the user leaves the default values as presented, null values are returned to the controller.

The definition is:
@(Html.Kendo().DropDownListFor(c=>c.Site)
.Name("Site")
.DataTextField("SiteDescription")
.DataValueField("Site")
 
 
.DataSource(source=>source
    .Read(read=>read.Action("GetSiteLookUpList","ManualData"))))
@Html.ValidationMessageFor(c => c.Site  )
Do I need to set anything else so the default value is posted back?



AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 29 Jan 2013
1 answer
48 views
Is it possible to initialise grid from table that only contains one page of datasource and use remote datasource for another pages?

Ie. there will be HTML table containing page 5 and I want to generate kendo grid from this table and need to tell kendo that its page 5 and to load another pages to use datasource.
Vladimir Iliev
Telerik team
 answered on 29 Jan 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?