KendoNumericTextBox

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hello

I'm working on the change from

@ Html.DropDownListFor (model => model.EnteredQuantity, Model.AllowedQuantities, new {@class = "qty-dropdown"})

to

@ Html.TextBoxFor (model => model.EnteredQuantity, new {@class = "qty-input"})

But I would like my new TextBox to be in the same style as the admin side textbox (with kendo numeric with plus and minus buttons)

How do I match ID <#ID> to @ Html.TextBoxFor ??


                  <Script>
                         $ (document) .ready (function () {
                             $ ("<ID #>"). KendoNumericTextBox ({
                                 format: "#",
                                 decimals: 0,
                                 Step: 5,
                                 max: 100
                             });
                         });
                     </ Script>
6 years ago
dspriveri wrote:
Hello

I'm working on the change from

@ Html.DropDownListFor (model => model.EnteredQuantity, Model.AllowedQuantities, new {@class = "qty-dropdown"})

to

@ Html.TextBoxFor (model => model.EnteredQuantity, new {@class = "qty-input"})

But I would like my new TextBox to be in the same style as the admin side textbox (with kendo numeric with plus and minus buttons)

How do I match ID <#ID> to @ Html.TextBoxFor ??


                  <Script>
                         $ (document) .ready (function () {
                             $ ("<ID #>"). KendoNumericTextBox ({
                                 format: "#",
                                 decimals: 0,
                                 Step: 5,
                                 max: 100
                             });
                         });
                     </ Script>


Have to lead kendo lib.

Inclide  like ==>

@{
var kendoVersion = "2014.1.318";
Html.AppendCssFileParts(string.Format("~/Administration/Content/kendo/{0}/kendo.rtl.min.css", kendoVersion));
    Html.AppendCssFileParts(string.Format("~/Administration/Content/kendo/{0}/kendo.default.min.css", kendoVersion));
    Html.AppendCssFileParts(string.Format("~/Administration/Content/kendo/{0}/kendo.common.min.css", kendoVersion));

//scripts
    Html.AppendScriptParts(string.Format("~/Administration/Scripts/kendo/{0}/kendo.web.min.js", kendoVersion));
}


          
 <Script>
                          $ (document) .ready (function () {
                              $ ("#EnteredQuantity"). KendoNumericTextBox ({
                                  format: "#",
                                  decimals: 0,
                                  Step: 5,
                                  max: 100
                              });
                          });
                      </ Script>
6 years ago
Little correction you try like ==\>


<Script>
                          $ (document) .ready (function () {
                              $ ("#@Html.FieldIdFor(model => model.EnteredQuantity)"). KendoNumericTextBox ({
                                  format: "#",
                                  decimals: 0,
                                  Step: 5,
                                  max: 100
                              });
                          });
                      </ Script>
6 years ago
Thanks Soher, for the answer.
Unfortunately there are problems with the KendoNumericTextBox library,
through the inspect google (F12) I saw that tells me
"Uncaught TypeError: $ (...). KendoNumericTextBox is not a function"
if I look at the html source of the file, however, the Js and Css libraries you mentioned above are loaded.


<script type="text/javascript">
$(document).ready(function () {
      $("#@Html.FieldIdFor(model => model.EnteredQuantity)").KendoNumericTextBox({
          format: "#",
          decimals: 0,
          step: 5,
          max: 100
      });
});
</script>
6 years ago
using this construct is working me


<script>
$("#@Html.FieldIdFor(model => model.EnteredQuantity)").kendoNumericTextBox();
   var numerictextbox = $("#@Html.FieldIdFor(model => model.EnteredQuantity)").data("kendoNumericTextBox");
   var step = numerictextbox.step();
   numerictextbox.step(0.5);
</script>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.