This is a migrated thread and some comments may be shown as answers.

NumericTextBox in Detail Row

3 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raphael
Top achievements
Rank 1
Raphael asked on 24 May 2017, 08:38 AM

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

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 26 May 2017, 06:59 AM
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.
0
Raphael
Top achievements
Rank 1
answered on 30 May 2017, 01:06 PM

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

0
Stefan
Telerik team
answered on 01 Jun 2017, 07:00 AM
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 (charts) and form elements.
Tags
Grid
Asked by
Raphael
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Raphael
Top achievements
Rank 1
Share this question
or