Telerik Forums
UI for ASP.NET MVC Forum
7 answers
370 views
Successfully using the HTML Editor, I would like to give my users the ability to resize the editor window (like shown in the attachment scribble).



My question:

Is it possible to turn on this functionality or simulate it in some way (maybe something with splitter?)
Dimo
Telerik team
 answered on 07 Apr 2014
2 answers
126 views
I'm using Kendo UI Grid to populate list of data and when i click on particular row i need to redirect to another view page of that particular row. but i have a delete command for that particular row. When i try to delete particular row it redirect to another page.i don't need any redirection after deletion. so the possible solution is i want to deselect only the command column when i select a particular row. Both i need row selection but no need command column selection..Please give a solution  for this...

  @(Html.Kendo().Grid<Portal.Presentation.Web.BoundedContext.TNA.Template.MVC.Areas.Razor.Models.TemplateModel>()
                  .Name("grid_Template_Freeze")
                  .AutoBind(true)
                  .Groupable()
                  .Sortable()
                  .HtmlAttributes(new { style = "border: 0;" })
                  .Scrollable(a => a.Height("auto"))
                          .Selectable(sel => { sel.Mode(GridSelectionMode.Single); sel.Type(GridSelectionType.Row); sel.Enabled(true);
                          })
                  .Columns(c =>
                               {
                                   c.Bound(p => p.TemplateId).Hidden();
                                   c.Bound(p => p.TemplateName).Title("&nbsp;").Title("TEMPLATE NAME");
                                   c.ForeignKey(p => p.ProductTypeId, (System.Collections.IEnumerable) ViewData["ProductTypes"], "Key", "Value").Title("PRODUCT TYPE");
                                   c.ForeignKey(p => p.OwnershipId, (System.Collections.IEnumerable)ViewData["UserTypes"], "Key", "Value").Title("OWNERSHIP");
                                   c.Bound(p => p.CreatedOn).Title("CREATED DATE").Format("{0:dd/MM/yyyy hh:mm}");
                                   c.Bound(p => p.UpdatedOn).Title("LAST MODIFIED DATE").Format("{0:dd/MM/yyyy hh:mm}");
                                   c.ForeignKey(p => p.StatusId, (System.Collections.IEnumerable)ViewData["StatusTypes"], "Key", "Value").Title("STATUS");
                                   c.Command(command => command.Destroy()).Width(80);

                               })
                  .Events(evt => evt.Change("TemplateTaskHandler.onChange"))
                  .DataSource(dataSource => dataSource
                                                .Ajax()
                                                .Sort(sort => sort.Add(p => p.TemplateName).Descending())
                                                .Model(model =>
                                                               {
                                                                   model.Id(p => p.TemplateId);
                                                                   model.Field(p => p.TemplateId);
                                                               })
                                                .Events(events => events.Error("error_handler"))
                                                .PageSize(20).ServerOperation(false)
                                                .Destroy(destroy => destroy.Action("OnTempaleDelete", "List"))
                                                .Read(read => read.Action("OnTempaleRead", "List"))
                  ).Pageable(x => { x.Enabled(true); x.PreviousNext(true); x.PageSizes(true); x.Info(true); x.Input(true); x.Numeric(false); x.Refresh(true); }))



 var TemplateTaskHandler = {

        onChange: function (e) {

            var grid = $("#grid_Template_Freeze").data("kendoGrid");
            var item = grid.dataSource.data()[grid.select().index()];
            location.href = "@Model.ResolveRouteUrl(Portal.Presentation.Web.BoundedContext.TNA.Template.MVC.Areas.Razor.Models.TnaModelTypes.Update)" + "&tmpl=" + item.TemplateId;
        }
    };
}
administrator
Top achievements
Rank 1
 answered on 07 Apr 2014
1 answer
126 views
I'm work on asp.net mvc application, I used kendo UI controls in my application
I added many controls from kendo UI tools ,it worked correctly
when I tried to add Html.Kendo().ComboBox() tool it displayed in browser like text field not combo box and it didn't displayed any item of the control
I wrote the following example

@(Html.Kendo().ComboBox().Name("kcombobox").Placeholder("Select a value...") .BindTo(new string[] {"Bulgaria", "United States", "India","Australia", "United Kingdom"}  ) )

so where is the problem please
Dimo
Telerik team
 answered on 04 Apr 2014
3 answers
290 views
I am using the UI for ASP.NET MVC controls in my application and I need to be able to create PDFs of a view that dynamically loads data.  Is this possible and if so how would I go about doing it?
Stef
Telerik team
 answered on 04 Apr 2014
3 answers
210 views
Hi Guys,

First of all, here's my grid definition

@(Html.Kendo().Grid<DATACLASS_ATTRIBUTES_T012>()
            .Name("Grid")
            .ToolBar(commands => { commands.Create().Text("New Attribute"); })
            .Columns(columns =>
            {
                columns.ForeignKey("ATTRIBUTEID", ViewBag.Attributes).ClientTemplate("#: data.DC_ATTRIBUTES_T006 ? DC_ATTRIBUTES_T006.NAME : 'none'#").Width(270);
                columns.Command(command => { command.Edit().UpdateText("Save"); }).Width(173);
                 
            })
            .Pageable()
            .Sortable()
            .Scrollable()
            .Filterable()
            .Editable(mode => mode.Mode(GridEditMode.InLine))
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(5)
                .ServerOperation(false)
                .Model(model =>
                {
                    model.Id(v => v.ID);
                    model.Field(v => v.ATTRIBUTEID).DefaultValue(1);
                    model.Field(v => v.UOM_ID).DefaultValue(null);
                    model.Field(v => v.DATACLASS_ID).DefaultValue(Model.ID);
                })
                .Read(r => r.Action("GetAttributeByDataClass/" + Model.ID, "Attribute"))
                .Update(r => r.Action("UpdateDataClassAttribute", "Attribute"))
                .Create(r => r.Action("CreateDataClassAttribute", "Attribute"))
             )
        )

My validation issue is that, on create, if I try to save without selecting a value for UOM_ID, I get the "The field Measure Unit must be a number." error.
Here is the data annotation related to this field

[UIHint("MeasureUnitEditor")]
[Display(Name = "Measure Unit")]
public Nullable<int> UOM_ID;

How come that validation doesn't succeed when the dafault value for that field is null (as defined inside grid's model) and the model's field is Nullable??

My Goal here is to build a custom creation process...I'd like to set the measure unit only if the value choosen from the first field (attributeID - rendered as a combo) is of a certain type...
Is it possible?

Thanks
Fabio
Petur Subev
Telerik team
 answered on 04 Apr 2014
3 answers
106 views
Can we use the mobile mvc tabstrip with web?
I cant seem to get any css on my tabstrip

Also when initializing tabstript this messes up bootstrap menu, menu now covers page content.
Where am I going wrong,
Thanks


   
         @code
 Dim mobileTab As Kendo.Mvc.UI.MobileTabStrip = Html.Kendo.MobileTabStrip().Name("mobileTab").Items(Sub(items)
items.Add().Icon("contacts").Text("Products")
items.Add().Icon("cart").Text("Shopping Cart")
 End Sub) _
 .Events(Function(events) events.Select("onSelect"))
 
 
mobileTab.Render()
 End Code
         
      
        @Html.Kendo().MobileApplication().ServerNavigation(true)
Kiril Nikolov
Telerik team
 answered on 04 Apr 2014
5 answers
925 views
Kendo Grid with url takes to another kendo grid

I'm stuck with reading the querystring value from grid1 url to grid2 controller.. Any help appreciated..

Grid1

Index.cshtml
  columns.Bound(e => e.TCBSTAGE).Width(100).ClientTemplate("<a href='/" + "ControllerName" + "/Index?Batchno=#=BatchNo#'>#=TCBSTAGE#</a>");



Grid2Index.Cshtml

<script>$(function(){
   $("#grid").kendoGrid({
  dataSource: {
    transport: {
      read: {  
         url: "ControllerName2/GetRecords",
         contentType: "application/json",
         type: "POST"
      },
      parameterMap: function (options) {       
        return kendo.stringify(options);
      }
    },
    schema: {
      data: "Data",
      total: "Total"
   
    },
    pageSize: 10,
    serverPaging: true,
    serverFiltering: true,
    serverSorting: true
  },
  groupable: true,
  filterable: true,
  sortable: true,
  pageable: true,
  columns: [
 { field: "BatchNo", title: "BatchNo" },
 { field: "Fiscal_Year ", title: "Fiscal_Year" },
 { field: "Department", title: "Department" }
  ]
});
});</script>


Grid 2 controller.. I need to get the Batchno value here

ControllerName2.cs

  [HttpPost]
        public ActionResult GetRecords(int take, int skip, IEnumerable<Kendo.DynamicLinq.Sort> sort, Kendo.DynamicLinq.Filter filter)
        {
            //Batchno from grid1 url
           I need the querystring id from grid1 here....          }


Any Help appreiciated. Thank you
Bharathi
Top achievements
Rank 2
 answered on 03 Apr 2014
4 answers
302 views
Ok I'm using globalize.js and registering it BEFORE the kendo culture javascript, and using my helper to pick the right culture file.
In my case it is en-GB.

However, if I bind a DateTime column on my model in a KendoUI grid, it fails to display anything at all.

I have tried various ways as shown here.

columns.Bound(o => o.AuthorityDate);
columns.Bound(o => o.AuthorityDate).Format("{0:d}");
columns.Bound(o => o.AuthorityDate).Title("AuthorityDate").Format("{0:dd/MM/yyyy hh:mm:tt}");

If I switch things and register globalize.js AFTER the kendo javascript, it then binds successfully.

So, I understand that registering globalize.js BEFORE should make kendo use globalize as per the help documentation.

So why is this NOT working?  I am using MVC5.1 kendo build 2014.1.318

<script src="@Url.Content("~/Scripts/globalize/globalize.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/globalize/cultures/globalize.culture." Core.Helpers.CultureHelper.GetCurrentCulture() + ".js")" type="text/javascript"></script>

<
script src="https://da7xgjtj801h2.cloudfront.net/2014.1.318/js/kendo.all.min.js"></script>
<script src="https://da7xgjtj801h2.cloudfront.net/2014.1.318/js/kendo.aspnetmvc.min.js"></script>

<script src="@Url.Content("https://da7xgjtj801h2.cloudfront.net/2014.1.318/js/cultures/kendo.culture." + Core.Helpers.CultureHelper.GetCurrentCulture() + ".min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>
Richard
Top achievements
Rank 1
 answered on 03 Apr 2014
1 answer
107 views
On a partial view, with a model:

@model IEnumerable<HTServices.Models.TableName>
 
​ @foreach (var item in Model)
 {
 @Html.HiddenFor(m => item.TableNameId)
 <div class="row" style="margin-top: 8px;">
 <div class="col-sm-4 col-md-4 col-lg-4">
 @Html.DisplayFor(m => item.TableNameShow)
 </div>
 <div class="col-sm-4 col-md-4 col-lg-4">
 @Html.TextBoxFor(m => item.Note, new { @class = "text-box single-line wide-full" })
 </div>
 <div class="col-sm-2 col-md-2 col-lg-2">
 @(Html.Kendo().DatePickerFor(m => item.ExpirationDt)
 .Start(CalendarView.Month)
 .Min(DateTime.Now.AddMonths(-2))
 .Max(DateTime.Now.AddMonths(12)))
 
 </div>
 <div class="col-sm-1 col-md-1 col-lg-1">
 @Html.ActionLink("Delete", "TableNameDelete", new { id = item.TableNameId }, new { onclick = "return deleteTableNameRecById(this);", @class = "RemoveLinkImage" })
 </div>
 </div>
 }


Here, only the first DatePickerFor control is rendered.

In the HTML, the script block for the DatePicker is added to the HTML, but the entire span wrapper for the Kendo dpf is missing:

here is the first one that is good, and works:

<div class="col-sm-2 col-md-2 col-lg-2">
                <span class="k-widget k-datepicker k-header k-input" style="width: 100%;"><span class="k-picker-wrap k-state-default"><input name="item.ExpirationDt" class="k-input" id="item_ExpirationDt" role="combobox" aria-disabled="false" aria-expanded="false" aria-readonly="false" aria-owns="item_ExpirationDt_dateview" style="width: 100%;" type="text" value="4/1/2014" data-val-required="The Expiration Date field is required." data-val="true" data-val-date="The field Expiration Date must be a date." data-role="datepicker"><span class="k-select" role="button" aria-controls="item_ExpirationDt_dateview" unselectable="on"><span class="k-icon k-i-calendar" unselectable="on">select</span></span></span></span><script>
    jQuery(function(){jQuery("#item_ExpirationDt").kendoDatePicker({"format":"M/d/yyyy","min":new Date(2014,1,1,8,56,43,286),"max":new Date(2015,3,1,8,56,43,286),"start":"month"});});
</script>
 
            </div>

The above only exists for the first item rendered.

All others after the first are only :

<div class="col-sm-2 col-md-2 col-lg-2">
                <input name="item.ExpirationDt" id="item_ExpirationDt" type="date" value="4/1/2014"><script>
    jQuery(function(){jQuery("#item_ExpirationDt").kendoDatePicker({"format":"M/d/yyyy","min":new Date(2014,1,1,8,56,43,286),"max":new Date(2015,3,1,8,56,43,286),"start":"month"});});
</script>
 
            </div>

How do I get all DatePickerFor items rendered in the list?


R


Alexander Popov
Telerik team
 answered on 03 Apr 2014
4 answers
239 views
Hello,

i am facing strange issue with my unit tests and Kendo.Mvc.

My test consist of invoking of controller action which is basically a handler for Grid control:

public virtual ActionResult Get([DataSourceRequest]DataSourceRequest request)
{
    var products = _userService.GetProducts();
    result = products.ToDataSourceResult(request);
 
    return Json(result);
}

The error i am getting from the NUnit console is following:

System.IO.FileNotFoundException : Could not load file or assembly 'System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

All of my projects are targeted against .NET 4.5.1.
Web project is targeting Asp.NET Mvc 5.1 version, which means iam using System.Web.Mvc version 5.1.0.0.
Kendo.Mvc is from the latest release - 2014.1.318.545


To make things even more complicated, when i run the test in isolation (only this one) it passes flawlessly.
But when i try to invoke it using NUnit console it fails throwing the above error.

Any hint is appreciated,
Ljubomir
Ljubomir
Top achievements
Rank 1
 answered on 02 Apr 2014
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?