Telerik Forums
UI for ASP.NET MVC Forum
3 answers
171 views

Controllercode:

01.namespace vEF_AspApplication.Controllers
02.{
03.    public class AddressesController : Controller
04.    {
05.        private MyDataModelContext db = new MyDataModelContext();
06. 
07.        // GET: Addresses
08.        public async Task<ActionResult> Index()
09.        {
10.            var addresses = db.Addresses.Include(a => a.FormOfAddress).Include(a => a.Title);
11.            return View(await addresses.ToListAsync());
12.        }
13.    }
14.}

Viewcode:

01.@(Html.Kendo().MobileView()
02.    .Title("EntityFramework DataAccess")
03.    .Name("Index")
04.    .Content(@<text>
05.        <div id="AddressList">
06.          @(Html.Kendo().Grid<vEF_Library.Address>()
07.          .Name("AddressGrid")
08.          .Columns(columns =>
09.              {
10.                  columns.Bound(c => c.LastName);
11.                  columns.Bound(c => c.FirstName);
12.                  columns.Bound(c => c.Phone);
13.              })
14.                .HtmlAttributes(new { style = "height: 100%;" })
15.                .HtmlAttributes(new { style = "width: 100%;" })
16.                .Scrollable()
17.                //.Groupable()
18.                .Sortable()
19.                .Pageable(pageable => pageable
20.                .Refresh(true)
21.                .PageSizes(true)
22.                .ButtonCount(10))
23.                .DataSource(dataSource => dataSource
24.                .Ajax()
25.                .Read(read => read.Action("Index", "Addresses"))
26.                )
27.            )
28.        </div>
29.    </text>)
30.)

What is wrong?

Alexander Popov
Telerik team
 answered on 11 Nov 2015
7 answers
203 views
Hi,

We've been using the Telerik MVC UI extensions and have just purchased the Kendo UI Complete for MVC and are working on upgrading our project templates to use Kendo. Part of this upgrade process has been looking at ways to reduce bandwidth consumption. Currently our pages are returning about 4MB of scripts and most of those scripts are not used on the majority of the pages. Which lead us to looking at RequireJS so we can load only the scripts that the page needs. This will reduce the scripts requested from 4MB+ to around an average of 300KB and Kendo UI does support RequireJS. But, that would require us to code all the Kendo widgets in javascript and not use the MVC server wrappers, which is a big reason for us to use Kendo in the first place.  

So, I started looking at the Kendo.Mvc source code and found that it's relatively trival to add the ability to wrap the rendered javascript in the appropriate requireJs code. I implemented a basic version, similar to how the Deferred Scripts are handled, and it was only about 50 lines of code.  

I generally don't like modifying third party code as when updates occur, I have to re-apply my modifications.

So, my question is:
Is adding requireJS support to the server wrappers something that is being worked on? And if so, is there an ETA?



Kai
Top achievements
Rank 1
 answered on 10 Nov 2015
9 answers
137 views

With the release of ASP.NET 5 beta 8 ...when we upgraded our MVC web application from 7 to 8 we ran into the following error.

 

Microsoft.AspNet.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

 

This was being caused by the Kendo.Mvc of reference of which we were using the 2015.3.930 release. We are wondering when will there be a release made that will be compatible with the latest beta release since the RC1 is supposed to be released in only a few short weeks from now and we are trying to keep our upgrade project rolling along with these releases.

 

We are hoping to not have to remove the reference and then switch our control usage from the wrappers back to coding everything in typescript. As this would cause us to have to refactor our controllers to remove the DataSourceRequest usages.

 

Thanks for any information you can provide.

 

AJ

 


 
Davide
Top achievements
Rank 1
 answered on 10 Nov 2015
5 answers
2.0K+ views

Hi,

 I have a Grid with batch editing. When I start to edit cell I have to capture the value of it (with changes made while editing) to send it to the controller. 

 How can I get this value? I have managed to get the cell itself with following javascript but it does not hold the value:

 

function cellData() {
     var grid = $("#CustomerOrderPosition").data('kendoGrid');
     var cellId = grid._cellId;
     var cell = document.getElementById(cellId);
 }

Viktor Tachev
Telerik team
 answered on 10 Nov 2015
1 answer
181 views

Greetings!  I have a set of grids to export to Excel.  I completed the first, with the help of your fine demo apps.

I have quite a bit of code for the OnExcelExport(e) event to set Excel column widths, cell colors, etc.  For example:

//Set column width and wrap text
if (colIndex == 0) {
    row.cells[colIndex].wrap = true;
    sheet.columns[colIndex].autoWidth = false;
    sheet.columns[colIndex].width = 63;
}
if (colIndex == 5 || colIndex == 6 || colIndex == 7) {
    row.cells[colIndex].wrap = true;
    sheet.columns[colIndex].autoWidth = false;
    sheet.columns[colIndex].width = 72;
}

My question is :Is there a way to store metadata in the column definition of the grid that I can read in OnExcelExport(e) so that I can create shared, generic functions to set the Excel attributes or must I code each grid like this (referencing column order, etc.)?  I tried stuffing attributes in the clientTemplate but this always seemed to affect my HTML grid...

Best,
Scott

Dimiter Madjarov
Telerik team
 answered on 09 Nov 2015
2 answers
128 views

 

If I have a treelist or grid with "popup" editing and an autosync datasource, how can I have the popup editor appear immediately for the new record?

It seems that with autosync, the create action is called immediately and no popup editor appears.

Ideally I would like the popup before going to the create action (same as without autosync).

It would be acceptable for the popup to appear after calling the create action on the server, so that it is editing a record filled with defaults.

Rosen
Telerik team
 answered on 09 Nov 2015
1 answer
148 views

Hi,

I have a chart which shows 3 lines. My client asks whether it is possible to have a background color between the lowest and highest line inside the area.
See the attachment for my example. The red lines mark the area which should be a light, gray color.

Any ideas?

Best,
Daniel

 
T. Tsonev
Telerik team
 answered on 09 Nov 2015
1 answer
78 views

 I have a combobox as a wrapper in MVC within a cshtml page.  I need to modify the read.URL to build my url and supply the appropriate search criteria.  I found a similar question and provided a link below to the answer, however this is using pure javascript and doesn't really fit my situation. How do i create a custom function in the .Read of the datasource so that i can build my url but do it with the MVC Wrapper?  Also is there more detailed documentation with comments etc the api just shows you a very slim example for a feature and doesn't really document what is going on.  Any help would be appreciated.

 

 Link to answer that answers my exact question but i need the answer for the MVC Wrapper not javascript:

http://www.telerik.com/forums/how-do-i-specify-a-variable-in-the-middle-of-data-source-read#BPwmciunhUyELOSvZKBqIQ

Georgi Krustev
Telerik team
 answered on 09 Nov 2015
7 answers
201 views
Hi All,

Does PivotGrid supports custom client-side filtering?
I see PivotConfigurator has powerful filtering functionality however I need to make my own filters applied to the Pivot Data.
Is there any API I can use to create my own filtering drop-downs or default filtering criteria.

I guess PivotGrid and PivotConfigurator has this functionality, but is it available for client scripts?

Thank you,
Andrei

P.S. I'm creating a POC to evaluate different vendors of pivot controls for ASP.Net MVC (Webforms is also an option).
Georgi Krustev
Telerik team
 answered on 09 Nov 2015
7 answers
1.9K+ views
I am trying to do some filtering on a grid, and I want to filter where a field is not equal to null.  I have the following javascript:
var grid = $("#Grid").data("kendoGrid");
$filter = new Array();
if (contact == true) {
   $filter.push({ field: "ContactDate", operator: "neq", value: null });
grid.dataSource.filter($filter);

This doesn't work though. I get a 500 error: System.ArgumentException: Invalid property or field - 'null' for type: 'MyView'.  How do I filter on my date field not being null?
Vladimir
Top achievements
Rank 2
 answered on 08 Nov 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?