We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Problem with NumericTextBoxFor

I have craete a simple MVC Project.  I want to do a small sample to add tow numbers.
I have created a view with 3 text boxes and take textbox3=textbox1 + Textbox2 when i click on a button.


I have crate the following Model:
    public class CalculatorModel
    {
        public int Result { getset; }
        public int FirstOperand { getset; }
        public int SecondOperand { getset; }
    }
I have create the following Controller:

    public class CalculatorController : Controller
    {
        [HttpGet]
        public ActionResult Sum()
        {
            CalculatorModel model = new CalculatorModel();
            model.FirstOperand = 100;
            model.SecondOperand = 200;
 
            return View(model);
        }
 
        [HttpPost]
        public ActionResult Sum(CalculatorModel model)
        {
            model.Result = model.FirstOperand + model.SecondOperand;
            ViewBag.Result = model.Result.ToString();
 
            return View(model);
        }
    }

and I have following View:

@model SyncfusionMobileMvcTestApp.Models.CalculatorModel @{     ViewBag.Title = "Sum"; } <h2>Sum</h2>     @using (Html.BeginForm())     {        <table border="0" cellpadding="3" cellspacing="1" width="100%">        <tr valign="top">            <td>               @Html.LabelFor(model => model.FirstOperand)               @{                     Html.MobSyncfusion().NumericTextBoxFor(model => model.FirstOperand).ShowSpinButton(true).RenderMode(RenderMode.Auto).Render();                 }            </td>        </tr>        <tr valign="top">            <td>               @Html.LabelFor(model => model.SecondOperand)               @{                     Html.MobSyncfusion().NumericTextBoxFor(model => model.SecondOperand).ShowSpinButton(true).RenderMode(RenderMode.Auto).Render();                 }            </td>        </tr>        <tr valign="top">            <td>               @Html.LabelFor(model => model.Result)              @{                      Html.MobSyncfusion().NumericTextBoxFor(model => model.Result).ShowSpinButton(true).RenderMode(RenderMode.Auto).Render();                 }            </td>        </tr>        </table>         <div style="text-align:right;">             <input type="submit" id="btnSum" value="Sum values" />         </div>              }
Now I have two problems:

1. The values ​​from the model (FirstOperand = 100 SecondOperand = 200) are not included in the view while loading the page. When I use the standard text box (@Html.TextBoxFor) values ​​are shown.

2.  The result is also not shown in the corresponding text box. When debugging, but is expected correctly.

What am I doing wrong? Does anyone have an idea or a sample project?



Picture_ed872120.rar

9 Replies

TH Thivya Syncfusion Team April 29, 2013 09:42 AM UTC

Hi Frank,

Thanks for your interest in Mobile MVC product.

The reported behavior is the mvc’s default behavior. You have to use ModelState.Clear() in your controller method to make the html helpers to use your updated model. Otherwise they will use the values from the form submit. We have also done the same in sample for your reference and attached.

Please try this and let us know if it helps.

Regards,
Thivya.



Textbox_6f060aa3.zip


FW Frank Wachsmuth April 29, 2013 11:07 AM UTC

Hi,
thank you for the sample project. But the project dose not work, on submit the form a loading panel is shown (see attachment). The result is not displayed. With standard textboxes is works perfectly.


picture2_6b1318df.rar


TH Thivya Syncfusion Team April 30, 2013 06:32 AM UTC

Hi Frank,

We have gone through the screenshot you sent. On seeing that we suspect that you are using MVC textbox because the appearance differs from our Mobile MVC Numeric Textbox. And also we have ensured the sample which we sent to you in previous update. But we are not able to reproduce the mentioned issue. We are getting the resultant output properly after the popup gets hide. Please find the output screenshot in the attachment.

Please ensure whether you are using our Mobile MVC Numeric textbox or not, if you still facing issue then could you please send the sample and let us know the browser version you using. So that we could find out the cause of the issue and help you further.

Regards,
Thivya.


Output_12f6a58e.zip


FW Frank Wachsmuth April 30, 2013 11:31 AM UTC

Hi,
i have used your Sample Projekt. When I run the project from the development environment appears in the text boxes "NaN" (see picture1). When I run the project in IIS, the values ​​are displayed. But the spin buttons are missing (see picture2). This behavior is in all browsers like that. I have tested the application on an iPhone, with the same result. You can test the App on http://ocsmw.ocsma.de/MVC2.

Regards,
Frank


Textbox_Sample_dd52d7b5.zip


TH Thivya Syncfusion Team May 1, 2013 09:12 AM UTC

Hi Frank,

Please find the response for your queries.

Regarding ‘NaN issue:

We afraid that we are not able to reproduce the issue. We have ensured the sample which you sent but its working fine and its displaying the initial value and resultant value properly. Could you please share the OS information, .Net version, MVC version and browser details with us so that we could sort out the root cause of the issue. The information you provide will be great helpful for us to assist you further.

Regarding deployed sample:

We have checked the given link. We suspect that you could have missed to include AjaxMin dll in the bin folder. So, please copy AjaxMin.dll to your bin folder of the application to resolve the reported issue. This Ajax.Min.dll is already shipped with the build, you can find the dll in the below location.

C:\Program Files (x86)\Syncfusion\Orubase Studio\1.1.0.69\Assemblies\4.0

By default, the StyleManager enables minification, compression and combination of CSS resources, hence this ajaxmin dll is required in the deployment. Also, we have added this reference details in the Online Documentation. Please refer to the following link.

http://help.syncfusion.com/UG/orubase/Documents/dlllist.htm

Please let us know if you have any queries.

Regards,
Thivya.



FW Frank Wachsmuth May 1, 2013 12:22 PM UTC

Hi,
i have copy the AjaxMin.dll in bin folder. Thank you for this tip.

Now the buttons are visible. But values ​​are not shown, it is now "NaN" displayed. (See Attachment or http://ocsmw.ocsma.de/mvc2).

The project is deployed on an Windows Server 2008 R2 (IIS 7) with .NET Framework 4.0. In this case i use MVC 3. I have tested the project with Firefox, IE 9, Google Chrome and Safari.

My development maschine has Windows 7 Ultimate, Visual Studio 2010, .NET Framework 4.

Sorry for my bad english.

Regrads,
Frank


Picture_2f226c92.rar


TH Thivya Syncfusion Team May 3, 2013 10:49 AM UTC

Hi Frank,

Currently we are working on your query. We are not able to reproduce the issue you mentioned but we are trying the possibilities to reproduce the issue. So once its reproduced we will update you the details regarding the cause of the issue you mentioned.

Appreciate your patience.

Regards,
Thivya.


TH Thivya Syncfusion Team May 6, 2013 06:43 AM UTC

Hi Frank,

We regret for the inconvenience.

Now, we are able to reproduce the "NAN" issue. On our further analysis we found that the issue occurs because of localization, so we have confirmed this as a defect. We will fix this issue and it will be available in our Orubase 2 release which is tentatively scheduled to be release on mid of May 2013. We will let you know once the release rolled out successfully.

Regards,
Thivya.



TH Thivya Syncfusion Team May 27, 2013 07:05 AM UTC

Hi Frank,

We are glad to announce that our  Essential Studio Vol 2 2013 is rolled out and is available for download under the following link.

http://www.syncfusion.com/support/forums/general/108998/Essential-Studio-2013-Volume-2-Final-Release-v112025-available-for-download-

We regret that the Orubase release has been postponed to end of June, 2013. But the mentioned localization issue in Numeric textbox has been fixed and is available in Mobile MVC.

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

Regards,
Thivya.


Loader.
Live Chat Icon For mobile
Up arrow icon