Telerik Forums
UI for ASP.NET MVC Forum
1 answer
871 views

Hello support,

I am using a MultiColumnComboBox widget in this way

 

01.@(Html.Kendo().MultiColumnComboBoxFor(x => x.PostBack.Expediente.IdCliente)
02.    .DataValueField("ID")
03.    .DataTextField("Nombre")
04.    .Columns(columns =>
05.    {
06.        columns.Add().Field("Nombre").Title("Cliente").Width("200px");
07.        columns.Add().Field("Mercado").Width("200px");
08.        columns.Add().Field("Subgrupo").Width("200px");
09.    })
10.    .Filter(FilterType.StartsWith)
11.    .BindTo(Model.Clientes)
12.    .HtmlAttributes(new { data_bind = "value: Expediente.Cliente" })
13.)

 

So far so good.

The question is: How can I specify the width of the whole dropdown list and in case the sum of the width of each column is greater than the width of the whole dropdown list then show a horizontal scroll bar (like the grid widget does) ?

Attached is a screenshot of the current widget rendered and below it the scrollbar I want to show (if necessary)

Thank you.

PD: I’ve tried with this post but it didn’t work https://www.telerik.com/forums/dropdownlist-should-take-size-of-biggest-option

Marin Bratanov
Telerik team
 answered on 20 Feb 2019
3 answers
400 views

I need to display a confirmation dialog on the screen using kendo.confirm. Everything work as expected until I resized the browser to see if the message displays correctly on the mobile. However the confirmation dialog text did not wrap on the screen. I tried to reproduce this in a dojo but can not. After further investigation I found that my site is missing the "display: block" or "display: inline-block" from the window wrapper.

Could you tell me who adds this so I can try to debug and see why the "display" property is not added.

Dimitar
Telerik team
 answered on 18 Feb 2019
4 answers
5.8K+ views

Would someone be able to provide a code snippet of how to programmatically select a row in the Kendo MVC Grid? 

We have the value for the ID (a column in the Grid) in a javascript variable.  We want to display the matching row in our grid and mark it as selected.  I saw the Kendo demos on how to select the row using grid.select(n), where n is the index into the row on the page.  But the demo example doesn't solve this problem.

Note, my data contains several thousand rows and my pageSize is limited to 10 rows per page.

@(Html.Kendo().Grid<ReportViewer.Models.EntityModels.tblTreeView>()
   .Name("grid")
   .Columns(columns =>
   {
     columns.Bound(c => c.Name).Title("Report Name");
     columns.Bound(c => c.Path).Title("Path");
     columns.Bound(c => c.Id).Title(string.Empty).Width("200px");
   })
   .Pageable(pageable => pageable.Refresh(true).PageSizes(true).ButtonCount(3))
   .Selectable()
   .Events(e => e.Change("showInTree"))
   .Sortable(sortable => { sortable.SortMode(GridSortMode.SingleColumn); })
   .DataSource(dataSource => dataSource
   .Ajax()
   .Model(model => model.Id(p => p.Id))
   .Sort(sort => sort.Add("Name").Ascending())
   .PageSize(10)
   .Read(read => read.Action("ReportsGridRead", "Home"))
)
)

 

Any help is greatly appreciated.

Viktor Tachev
Telerik team
 answered on 18 Feb 2019
1 answer
2.2K+ views

As the title states, is it possible to submit multiple partial views with a single button? Open to using javascript, jquery, ajax. 

I have them coming from the same model, but there are two partial views with separate forms, I am wondering if there is anyway to submit it with just using a single click?

Thanks

Marin Bratanov
Telerik team
 answered on 18 Feb 2019
2 answers
2.2K+ views

Hi All,

I have a grid inside a partialview of index view in a MVC project. I add a context menu to the grid. This menu has 4 items.  Which item(s) will show up depends on how many rows of grid are selected. I assign id to each menu item and tried to use hide() and show() to show certain menu item(s) but it doesn't work.  Anyone know how to do that?

Thanks.

Daochuen
Top achievements
Rank 1
Iron
Veteran
Iron
 answered on 15 Feb 2019
3 answers
1.1K+ views

 

I use a gridview with inline editing, when i Update a double value with 

This is the grid :

@(Html.Kendo().Grid<Ubaldi.BoB2B.Web.Models.FraisDePort.FraisDePortViewModel>()
         .Name("FraisGrid")
         .Columns(columns =>
         {
             columns.Bound(e => e.Id).Hidden(true);
             columns.Bound(e => e.Article);
             columns.Bound(e => e.PoidsMin).ClientTemplate("#= PoidsMin # kg");
             columns.Bound(e => e.PoidsMax).ClientTemplate("#= PoidsMax # kg");
             columns.Bound(e => e.MontantHT).ClientTemplate("#= MontantHT # €");
             columns.Command(command => { command.Edit().UpdateText("Enregistrer").CancelText("Annuler").Text(" ");}).Width(100);
             columns.Command(command =>
             {
                 command.Custom("Logs").Click("FraisLogs")
                     .Text("<span class='fa fa-list-alt'></span>")
                     .HtmlAttributes(new { @class = "btn btn-info", title = "Voir les modifications effectuées sur l'Article de Transport" });
             }).Width(50);
         })
         .Editable(editable => editable.Mode(GridEditMode.InLine))
         .DataSource(dataSource => dataSource
             .Ajax()
             .Events(events => events.Error("error_handler"))
             .Read(read => read.Action("GetAll", "FraisDePort"))
             .Update(update => update.Action("Update", "FraisDePort").Data("addUser"))
             .Model(model =>
             {
                 model.Id(p => p.Id);
             })
             .PageSize(20)
         )
         .Pageable(pageable => pageable.ButtonCount(5)))

 

This is my View Model:

public class FraisDePortViewModel : IValidatableObject
   {
 
       public int Id { get; set; }
 
       [Required, StringLength(100, MinimumLength = 3, ErrorMessage = "Le Nom de l'Article de Transport doit faire entre 3 et 100 charactères")]
       [DisplayName("Article de Transport")]
       public string Article { get; set; }
 
       [Required]
       [UIHint("Poids")]
       public double? PoidsMin { get; set; }
 
       [Required]
       [UIHint("Poids")]
       public double? PoidsMax { get; set; }
 
       [UIHint("Currency")]
       [Required, Range(1, 9999, ErrorMessage = "Le Montant HT doit être supérieur à 0 €")]
       public decimal? MontantHT { get; set; }
 
       [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy HH:mm}", ApplyFormatInEditMode = true)]
       [DisplayName("Créé le")]
       public DateTime? DateCreation { get; set; }
 
       [DisplayName("Créé par")]
       public string UserCreation { get; set; }
 
       [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy HH:mm}", ApplyFormatInEditMode = true)]
       [DisplayName("Modifié le")]
       public DateTime? DateModification { get; set; }
 
       [DisplayName("Modifié par")]
       public string UserModification { get; set; }
 
       public List<FraisDePortLog> Modifications { get; set; }
 
       public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
       {
           if (PoidsMin > PoidsMax)
           {
               yield return new ValidationResult("Le Poids Minimum doit être supérieur au Poids Maximum ", new List<string> { "Poids" });
           }
       }
   }

 

This is my EditorTemplate "Poids"

@model double?
 
@(Html.Kendo().NumericTextBoxFor(m => m)
      .Culture("fr-FR")
      .Min(0)
      .Max(15)
      .Step(0.50))
      

 

This is what i receive when I post modification with decimals (see Attachement).

Additionnals info :

  • Kendo 2018.3.911.545 
  • Culture is set to fr-FR in web.config solution

Do you have an idea to fix this issue of null value ?

Thank you, 

Julien

 

UBALDI SI
Top achievements
Rank 1
 answered on 15 Feb 2019
8 answers
1.0K+ views
Since all the new web project templates in VS 2013 seem to use Bootstrap it would seem Microsoft have adopted this as their "default" layout template. As such I'd expect the Kendo UI libraries to work seamlessly with Bootstrap.

I have seen some documentation on this but the only guidance I can find on using the Kendo UI menu control with Bootstrap was this unanswered post on StackOverflow:
http://stackoverflow.com/questions/17729394/how-do-i-modify-the-kendo-ui-menus-default-html

So, to restate the question, what is the right way to use the Keno Menu control to put a drop down menu into the Bootstrap nav bar?
Dimitar
Telerik team
 answered on 14 Feb 2019
1 answer
286 views

I have been trying for several days to bend the menu to my will, and nothing has worked.

I'm using MVC5, Bootstrap 3, and Telerik UI for MVC (2019.1).

I have a div that is 28px tall, and I'm trying to get the menu to be constrained within that div's height. The problem is that the menu appears to be padded/margined and is 50px tall, regardless of the class styles I've tried to set. There doesn't appear to be any documentation (that I've found) that describes how to re-style the components.

For instance, it would be real nice if I could find a description regarding what to do to change the colors, the sizes, and the positioning. What css classes affect each widget?

 

Dimitar
Telerik team
 answered on 14 Feb 2019
3 answers
5.5K+ views

Hi!

I'm getting all red squigglies on my CSHTML files but the site is still working without compile-time or runtime errors. I'm getting this warning on CSHTML that has Kendo() used on them:

Warning CS1702

Assuming assembly reference 'System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' used by 'Kendo.Mvc' matches identity 'System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' of 'System.Web.Mvc', you may need to supply runtime policy

Also, maybe not related, but all kendo control is not rendering properly at all: Attached

Here is my Web.Config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    </configSections>
    <appSettings>
        <add key="webpages:Version" value="3.0.0.0" />
        <add key="webpages:Enabled" value="false" />
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />         
    </appSettings>
    <system.web>
        <authentication mode="Windows" />
        <authorization>
            <deny users="?" />
        </authorization>
        <compilation debug="true" targetFramework="4.7.1">
            <assemblies>
                <add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
            </assemblies>
        </compilation>
        <httpRuntime requestValidationMode="4.7.1" targetFramework="4.7.1" encoderType="System.Web.Security.AntiXss.AntiXssEncoder, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <globalization uiCulture="auto:en" culture="en-GB" />
        <pages>
            <namespaces>
                <add namespace="Kendo.Mvc.UI" />
            </namespaces>
        </pages>
    </system.web>
    <system.web.extensions>
        <scripting>
            <webServices>
                <jsonSerialization maxJsonLength="2147483644" />
            </webServices>
        </scripting>
    </system.web.extensions>
    <system.webServer>
        <staticContent>
            <remove fileExtension=".woff" />
            <remove fileExtension=".woff2" />
            <remove fileExtension=".otf" />
            <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
            <mimeMap fileExtension=".woff2" mimeType="font/woff2" />
            <mimeMap fileExtension=".otf" mimeType="font/otf" />
        </staticContent>
        <modules>
            <remove name="FormsAuthentication" />
        </modules>
        <httpProtocol>
            <customHeaders>
                <add name="Node" value="Local" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
    <runtime>
        <gcServer enabled="true" />
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-6.2.2.0" newVersion="6.2.2.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-5.2.4.0" newVersion="5.2.4.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

 

And here is the Views\Web.Config

<?xml version="1.0"?>
<configuration>
    <configSections>
        <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
            <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <system.web.webPages.razor>
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <pages pageBaseType="System.Web.Mvc.WebViewPage">
            <namespaces>
                <add namespace="System.Web.Mvc" />
                <add namespace="System.Web.Mvc.Ajax" />
                <add namespace="System.Web.Mvc.Html" />
                <add namespace="System.Web.Optimization"/>
                <add namespace="System.Web.Routing" />
                <add namespace="DA.Services.IBS.Web.FinancePortalFull" />
                <add namespace="Kendo.Mvc.UI" />
            </namespaces>
        </pages>
    </system.web.webPages.razor>
    <appSettings>
        <add key="webpages:Enabled" value="false" />
    </appSettings>
    <system.webServer>
        <handlers>
            <remove name="BlockViewHandler"/>
            <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
        </handlers>
    </system.webServer>
    <system.web>
        <compilation>
            <assemblies>
                <add assembly="System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            </assemblies>
        </compilation>
    </system.web>
</configuration>

 

I'm not using v5.2.3.0 of System.Web.Mvc. I'm on Kendo v2018.1.117.545

_Layout.s

@using DA.Services.IBS.Web.FinancePortalFull.Helpers
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns#">
    <head>
        <title>@ViewBag.Title | Finance System</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css'>
        <!-- Add local styles, mostly for plugins css file -->
        @if (IsSectionDefined("Styles"))
        {
            @RenderSection("Styles", required: false)
        }
        <!-- Add jQuery Style direct - used for jQGrid plugin -->
        <link href="@Url.Content("~/Scripts/plugins/jquery-ui/jquery-ui.min.css")" rel="stylesheet" type="text/css" />
        <!-- Primary Inspinia style -->
        @Styles.Render("~/Content/css")
        @Styles.Render("~/Content/plugins/kendo/css")
        @Styles.Render("~/Content/plugins/font-awesome/css")
        <!-- Section for main scripts render -->
        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/bootstrap")
        @Scripts.Render("~/bundles/kendo")
    </head>
    <body class="md-skin">
        <!-- Wrapper-->
        <!-- PageClass give you ability to specify custom style for specific view based on action -->
        <div id="wrapper" class="@Html.PageClass()">
            <!-- Navigation -->
            @Html.Partial("_Navigation")
            <!-- Page wraper -->
            <div id="page-wrapper" class="gray-bg @ViewBag.SpecialClass">
                <!-- Top Navbar -->
                @Html.Partial("_TopNavbar")
                @Html.Partial("_NotificationBox")
                <!-- Main view  -->
                @RenderBody()
                <!-- Footer -->
                @Html.Partial("_Footer")
            </div>
            <!-- End page wrapper-->
            @{
                <input id="BASE_URL" type="hidden" value="@(string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~/")))" />
            }
            <script type="text/javascript">
                window.applicationBaseUrl = @Html.Raw(HttpUtility.JavaScriptStringEncode(new Uri(new Uri(Context.Request.Url.GetLeftPart(UriPartial.Authority)), Url.Content("~/")).ToString(), true));
                window.BASE_URL = $("#BASE_URL").val();
            </script>
        </div>
        <!-- End wrapper-->
        <!-- Section for main scripts render -->
        @Scripts.Render("~/plugins/slimScroll")
        @Scripts.Render("~/bundles/inspinia")
        <!-- Handler for local scripts -->
        @RenderSection("scripts", required: false)
    </body>
</html>

 

Bundles:

// Kendo UI Scripts
bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
                "~/Scripts/plugins/kendo/kendo.all.min.js",
                "~/Scripts/plugins/kendo/kendo.aspnetmvc.min.js"));
// CSS style (kendo)
bundles.Add(new StyleBundle("~/Content/plugins/kendo/css").Include(
                "~/Content/plugins/kendo/kendo.common-material.min.css",
                "~/Content/plugins/kendo/kendo.material.min.css",
                "~/Content/plugins/kendo/kendo.dataviz.material.min.css",
                "~/Content/plugins/kendo/kendo.mobile.all.min.css",
                "~/Content/plugins/kendo/kendo.mobile.material.min.css",
                "~/Content/plugins/kendo/kendo.material-mobile.min.css"));

 

As per chrome's Network tab in dev-mode, there is no missing file and no errors on the console tab either.


Jay
Top achievements
Rank 1
Iron
Iron
 answered on 14 Feb 2019
2 answers
421 views

I'm working on a solution where I'm using pop-up editing. On create the the pop-up template appears and the Multi-select dropdown loads with data as shown below.

@(Html.Kendo().MultiSelect().Name("permissionsDropDown")
                  .Placeholder("Select Permissions...")
                  .AutoClose(false)
                  .DataTextField("Name")
                  .DataValueField("Id")
                  .DataSource(source =>
                  {
                      source.Read(read =>
                      {
                          read.Action("GetApplicationPermissions", "PermissionTemplates").Data("addApplicationIdToRequest");
                      })
                          .ServerFiltering(false);
                  })
            )

 

This loads the correct values into the multi select dropdown object correctly. If I select some items they are selected correctly but when I click on the 'Create' button the values are not passed to the controller correctly. The correct number of items is passed to the controller but the value for each is 0 as shown in the attached image.

 

 

Phillip
Top achievements
Rank 1
 answered on 13 Feb 2019
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?