NumericTextBox in Detail Row

4 posts, 0 answers
  1. Raphael
    Raphael avatar
    6 posts
    Member since:
    Feb 2013

    Posted 24 May Link to this post

    Hello,

    I'm currently trying to implement an ASP.NET MVC Grid that hosts products and displays additional product information via detail rows. The additional information in the detail row is depending on the product group (e.g. products of productgroup 1 should display additonal information a, b and c and products of productgroup 2 should display additonal information d, e and f). I tried to implement this using ClientDetailTemplateId combined with Partial Views:

    <script id="template" type="text/html">
        # if(Productgroup == "Productgroup1") { #
        @{ Html.RenderPartial("Partial/Productgroup1View"); }
        # } else if(Productgroup == "Productgroup2") { #
        @{ Html.RenderPartial("Partial/Productgroup2View"); }
        # } else { #
        @{ Html.RenderPartial("Partial/DefaultView"); }
        # } #
    </script>

     

    In the partial views in want to use a NumericTextBox to display product information like:

    @(Html.Kendo().NumericTextBox()
          .Value("#= NumericProductProperty1 #")
          .Name("NumericProductProperty1"))

     

    As the Value property of a numeric textbox needs a decimal this is not working.

    Is there any way to solve my problem? Is there a possibility to use early bound properties in client templates? In general: Is ClientTemplateId the recommended way to implement my requirements?

    I tried to solve my problem using a server-side DetailTemplate but this is not working with an Ajax datasource.

    Any help is appreciated!

    Regards

    Raphael

  2. Stefan
    Admin
    Stefan avatar
    1025 posts

    Posted 26 May Link to this post

    Hello Raphael,

    When additional details have to be used I can suggest using the ClientDetailTemplateId property of the Grid as shown in our demo example:

    http://demos.telerik.com/aspnet-mvc/grid/hierarchy

    Also, please check if the correct value is passed to the value property of the NumericTextBox.

    Additionally, check if there are any errors in the console, as there is a known issue when binding the NumericTextBox in Chrome. Try setting the type attribute to text, to check if this will fix the issue:

    .HtmlAttributes(new { style = "width: 100%", type="text" })

    If the issue still occurs, please send a fully runnable example, as it may be caused by a custom code which we are overlooking at this moment.

    Regards,
    Stefan
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Raphael
    Raphael avatar
    6 posts
    Member since:
    Feb 2013

    Posted 30 May Link to this post

    Hi Stefan,

    thank you for your reply. I think you misunderstood my problem. After further searching I found this and this forum posts which exaclty describe my problem.

    In the end I used another approach with standard Kendo TextBox:

    @(Html.Kendo().TextBox()
          .Enable(false)
          .Name("currencyproperty1")
          .Value("#=kendo.toString(Product.currencyproperty1, 'C')#"))

    Thank you anyway for your help.

    Regards

    Raphael

  4. Stefan
    Admin
    Stefan avatar
    1025 posts

    Posted 01 Jun Link to this post

    Hello Raphael,

    I'm glad to hear that you found a working solution to and issue.

    Also, thank you for sharing an approach which can be used in this scenario with the Kendo UI community, this is highly appreciated.

    Regards,
    Stefan
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top