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

RadNumericTextbox weird behaviour

21 Answers 612 Views
Input
This is a migrated thread and some comments may be shown as answers.
EmpowerIT
Top achievements
Rank 2
EmpowerIT asked on 29 Oct 2007, 11:30 PM
I have a simple RadNumericTextbox (prometheus version) with the following properties set.
<telerik:RadNumericTextBox ID="priceTextbox" runat="server" AutoPostBack="True" MinValue="0" Type="Currency"></telerik:RadNumericTextBox> 



I use the text box to capture some values from the user and save these values to the database. Everything works as expected at this stage.

However, when i retrieve the data from the database and attempt to redisplay the data some weird behaviour occurs. When the page loads, the text box appears to have the correct value in there (and focus is on that textbox). If i move focus away from the textbox, without changing the value, the text box will now display a number that is a factor of 100 less than the original
e.g. if the value was $250.00, once focus leaves the box it becomes $0.25.
If i manually type in 250 on top of the original 250 this problem does not occur.

The way i populate the textbox is shown below:

//unit_price is a decimal value retrieved from a database.
//This value is correct when retrieved from the database 
 
priceTextbox.Value = Convert.ToDouble(unit_price); 

Any help would be appreciated

21 Answers, 1 is accepted

Sort by
0
EmpowerIT
Top achievements
Rank 2
answered on 31 Oct 2007, 12:54 AM
I think i might know what the problem is (but still no idea how to fix it)

The RadNumericTextbox is the control that gets focus when the page is loaded. This is by default as I am not doing anything special with the focus to force it to go to a specific control.

Usually, when the RadNumeric control has focus, all the fancy formatting disappears and you just have the numbers you input. In my case, the formatting is still there when you have focus, and when you lose focus the value seems to divide by a factor of 100.

E.G
I've got focus on the numeric textbox control and the actual string still shows $250.00. If i move away it now shows $0.25. When i recfocus onto that control by clicking/tabbing/whatever it will display 0.25


0
EmpowerIT
Top achievements
Rank 2
answered on 31 Oct 2007, 12:59 AM
Temporary Fix
I've forced the focus to go to another control (a radcombobox) on pageload and it works fine.

I also tried forcing the focus to the numeric textbox instead of relying on the default focus, but this did not fix the problem.

Could there be some sort of race condition between the radnumeric textbox getting focus and working out whether or not it needs to display the orignal value or the formatted value?
0
Pavel
Telerik team
answered on 31 Oct 2007, 08:12 AM
Hi link64,

I tried to reproduce your problem in a sample website but the symptoms you describe are not showing. I have attached the demo for you to review and, if possible, modify it in such a way that the behavior you describe becomes evident. Thus I will be able provide more to-the-point answer/solution.

Kind regards,
Pavel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
EmpowerIT
Top achievements
Rank 2
answered on 31 Oct 2007, 10:17 PM
Hi,
I ran the demo you gave me and it DOES show the symptoms i'm describing.
I tried in both IE7 and Firefox (2.0.0.8), and I also tried it on a different computer.

THe problems occur in both regular and debug versions (<compilation debug="true">).

I extracted your project, opened it in VS2005, and started the website.
I then click on the button which posts back and sets a value of 250 to the textbox. When the page comes back up, the textbox has focus but is still displaying the formatted string, not the raw string. If i click away from the textbox, it changes to $0.25 ... i made a video of it happening, you can download the zip here (its small, only 3mb)
0
Giuseppe
Telerik team
answered on 01 Nov 2007, 04:22 PM
Hi link64,

The problem surfaced when we ran the project on IIS. Before that we were testing on the built-in Asp.Net Development server and everything was ok. We have logged this issue in our bugtracking system and we can suggest you the following workaround for the time being:

protected void Button1_Click(object sender, EventArgs e) 
    priceTextbox.Value = Convert.ToDouble(250); 
    this.Form.Controls.Add(new LiteralControl(string.Format(@"
    <script type='text/javascript'>
        window.setTimeout(function()
                        {{
                            $find('{0}').Focus();
                        }}, 10);
    </script>", priceTextbox.ClientID))); 


Sorry for the inconvenience.


Kind regards,
Manuel
the Telerik team


Instantly find answers to your questions at the new Telerik Support Center
0
EmpowerIT
Top achievements
Rank 2
answered on 15 Nov 2007, 11:12 PM
Hi,
Just wondering if there is going to be a 'permanent' fix soon for this bug

Cheers,
0
Giuseppe
Telerik team
answered on 16 Nov 2007, 02:32 PM
Hi link64,

We will do our best to fix it for the Q3 release of the controls in the middle of December.

Sorry for the temporary inconvenience.


Best wishes,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
EmpowerIT
Top achievements
Rank 2
answered on 15 Jan 2008, 02:14 AM
Just wondering if this has been fixed yet?
0
Giuseppe
Telerik team
answered on 17 Jan 2008, 05:43 PM
Hello EmpowerIT,

Unfortunately a permanent fix has not been integrated into the control yet. We will forward your inquiry to our developers and we will follow-up on this one here hopefully within a few days.


Greetings,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Accepted
Giuseppe
Telerik team
answered on 31 Jan 2008, 11:46 AM
Hi EmpowerIT,

Just a follow-up on this issue -- our developers were able to incorporate a permanent solution that will be included in the service pack release scheduled in about two weeks.

Hope this helps.


Greetings,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael Iannone
Top achievements
Rank 1
answered on 26 Feb 2009, 04:00 PM
Hi,
I am experiencing what I believe to be the same issue.  The rad numeric text box value magically changes when the focus changes (so far only in IIS).  I have the Q3 2008 version of Telerik.  Was the fix included in this build, or is there a service pack or patch that I need to install?

Thanks,
Mike
0
Sebastian
Telerik team
answered on 26 Feb 2009, 04:22 PM
Hello Michael,

Can you please verify that you are using the latest release 2008.3.1314 of RadControls for ASP.NET AJAX in your project? If the issue persists with this version, I suggest you isolate a stripped working version of your project, demonstrating it, and send it enclosed to a regular support ticket. We will test/debug it locally and will get around to you with our findings.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Michael Iannone
Top achievements
Rank 1
answered on 26 Feb 2009, 08:06 PM
Originally I had a slightly older version of the Rad dll.  After your comment I upgraded and retested and was still getting the same results.  I will work on building a sample solution for you, in the mean time here are some details:

-I can not reproduce locally running on Visual Studio 2008, Windows XP, and IIS 5.1 (or build in VS web server)
-When I deploy to our testing server it is reproducible.  The testing server has Windows Server 2008 and IIS7
-By reproducible I mean it happens often, but not all the time.  I cant seem to figure out why sometimes it does/doesnt happen
-The comment earlier mentions it seems to divide by 100, this is not always true.  It changes 99.00 to 0.99, but sometimes it is not exactly divided by 100 and does stuff like 986 to 0.90
-Also, it seems to not to it (or change the value less frequently) when I actually type in the decimal place data.  For example if I type '99' the formatting on the text box changes it to $99.00, and then later to $0.99.  However, I typed in '99.00' (including the decimal and zeros) and it did not seem to change it to the 0.99.  This may have just been a coincidence since it does not seem to change the value all of the time.

Hope that helps, if you dont tell me anything else I will try to open a support ticket with a sample project file.

Thanks.
0
Michael Iannone
Top achievements
Rank 1
answered on 26 Feb 2009, 09:07 PM
So far I have been having trouble reproducing this issue in a simpler/smaller project.  If there is any advice you can give based off of my comments above it would be appreciated.  In the mean time I will try to strip down my solution enough to make it manageable and demonstrate this error.
0
Sebastian
Telerik team
answered on 27 Feb 2009, 09:14 AM
Hello Michael,

The issue is quite odd and unfortunately based on the information so far I am not able to provide pointers which to help you trace the cause of the abnormality and eliminate it. We will be expecting your sample project to investigate the matter further and hopefullly will provide up-to-the-point explanation/solution.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Matt
Top achievements
Rank 1
answered on 02 Apr 2009, 07:24 PM
Hello,
I am having a similar error, I just did an update to version 2008.3.1314. So what ever was fixed in that version didn't fix the entire problem. This is the application scenario it happens with. I have a radgrid located within an updatepanel and a rad loading panel. I'm using an edit template that is dynamically create in the code behind depending on which fiscal year the data in the grid is from. I create this form in the itemcreated section using a table and add the controls to table cells. After the page loads I open my edit form, it again builds the form (it could changed based on a date selected), and displays it. Now the strange part if it on the first load, anything I put in the numerictextbox on loose focus gets set to a decimal and rounded (ie 123 is .12, 125 is .13) It does this for values that I set if I give them focus then move away. Though, after I do a post back of somesort, (click a button hit return anything) it works the way it is designed. Anyone have any ideas or solutions?

Also, this is a local copy on IIS 5.
0
Pavel
Telerik team
answered on 06 Apr 2009, 10:45 AM
Hi Matt,

Could you provide more details on how to reproduce the problem? Pasting some code/markup might help us in this regard.  Also, can you replicate the problem if the Input is outside of the Grid? Any further details are welcome.

Regards,
Pavel
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Matt
Top achievements
Rank 1
answered on 06 Apr 2009, 01:13 PM
 Private Sub grdEditPriorities_ItemCreated(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grdEditPriorities.ItemCreated 
        If TypeOf e.Item Is Telerik.Web.UI.GridEditFormItem Then  
For Each row As PROGRAM_PURP_PRIOR_PROFILEEntity.PROGRAM_PURP_PRIOR_PROFILERow In pentity 
                tr = New TableRow 
                td = New TableCell 
                td.BorderStyle = WebControls.BorderStyle.None 
                td.Text = row.PURPOSE_PRIORITY_ICD 
                tr.Cells.Add(td) 
                td = New TableCell 
                td.BorderStyle = WebControls.BorderStyle.None 
                box = New DTPCheckbox 
                box.ID = row.PURPOSE_PRIORITY_ICD 
                box.FieldName = row.PURPOSE_PRIORITY_ICD 
                For Each selected As ORG_APPLICATION_PURP_PRIOREntity.ORG_APPLICATION_PURP_PRIORRow In priorentity 
                    If selected.PURPOSE_PRIORITY_ICD = row.PURPOSE_PRIORITY_ICD Then 
                        box.Checked = True 
                        Exit For 
                    End If 
                Next 
                td.Controls.Add(box) 
                tr.Cells.Add(td) 
                table.Rows.Add(tr) 
            Next 
            tr = New TableRow 
            td = New TableCell 
            td.BorderStyle = WebControls.BorderStyle.None 
            Dim save As New LinkButton 
            Dim Cancel As New LinkButton 
            save.Text = "Save" 
            save.CommandName = "PerformInsert" 
            td.Controls.Add(save) 
            tr.Cells.Add(td) 
            td = New TableCell 
            td.BorderStyle = WebControls.BorderStyle.None 
            Cancel.CommandName = "Cancel" 
            Cancel.Text = "Cancel" 
            td.Controls.Add(Cancel) 
            tr.Cells.Add(td) 
            table.Rows.Add(tr) 
            e.Item.Cells(1).Controls.Add(table) 
end if 
this is the vb code to create the edit form, I took out the part that creates pentity its just a datatable with


<ajax:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional"
        <ContentTemplate> 
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="LoadingPanel1"
          <cc2:DTPRadGrid  ID="grdEditPurposes" runat="server" EnableEmbeddedSkins="false" AutoGenerateColumns="false" EnableViewState="true" Visible="true" Width="500px"
           <MasterTableView runat="Server" DataKeyNames="ORG_APPLICATION_PURP_PRIOR_ID" EditMode="EditForms" CommandItemDisplay="Bottom"
            <CommandItemTemplate> 
             <table width="100%"
             <tr> 
              <td align="right" style="width:50%">Total Requested:</td> 
              <td align="left"><cc2:DTPLabel ID="TOTAL_REQUESTED" runat="server" EnableViewState="true"></cc2:DTPLabel></td
             </tr> 
             <tr> 
              <td align="center" colspan="2"
               <asp:LinkButton ID="LinkButton7" runat="server" CommandName="initinsert">Edit</asp:LinkButton> 
              </td> 
              </tr> 
             </table> 
            </CommandItemTemplate> 
             <EditFormSettings EditFormType="Template"
             <FormTemplate> 
              <table class="contenttable" cellspacing="0" id="grdEditPurposesform"
               </table> 
              </FormTemplate> 
             </EditFormSettings> 
            <Columns> 
              
             <cc2:DTPBoundColumn DataField="PURPOSE_PRIORITY_ICD" HeaderText="Requested Purpose"></cc2:DTPBoundColumn> 
             <cc2:DTPBoundColumn DataField="DOLLAR_AMT" HeaderText="Amount" DataFormatString="{0:c}" HtmlEncode="False"  SortExpression="DOLLAR_AMT"></cc2:DTPBoundColumn> 
            </Columns> 
           </MasterTableView> 
          </cc2:DTPRadGrid> 
          </telerik:RadAjaxPanel> 
         </ContentTemplate> 
           <Triggers> 
            <ajax:AsyncPostBackTrigger ControlID="grdEditPurposes" /> 
           </Triggers> 
          </ajax:UpdatePanel> 

This is the aspx page. This exists inside a table in a raddock. I will try building it outside of a grid to see if that is the problem
0
Matt
Top achievements
Rank 1
answered on 06 Apr 2009, 01:40 PM
Also DTP radgrid is inherited from Radgrid, but we only did that to add properties none of which are in play, and to make it easier on ourselves to use some columns we created, again none of which are in play here. I'll try changing it to just a normal radgrid to eliminate the possiblity that those changes are causing the error (DTP bound column is inherited from boundcolumn just so we can access intellisense when using it in a dtpradgrid i'll change that also).
0
Matt
Top achievements
Rank 1
answered on 06 Apr 2009, 02:25 PM
I narrowed down the issue more this morning, When I removed the loading panel it works fine. So It must have something to do with that. I wasn't able to test outside of a grid with a loading panel. So not sure if that works, but created numerictextboxs in an updatepanel work fine. Looking at my code I didn't realize how much inheritance we were doing (like I said its just properties we use for other applications in the project). I know Telerik doesn't offer support for inherited items, though you may want to take a look at an application scenario similiar to mine and see if it could cause errors, I'm on a project deadline so I don't have time to rebuild the page with just telerik controls so if the issue was resolved when I removed the loading panel, the user will just have to do with out. Thank you for your time and energy, I don't know if you understand how great it is to get good customer service like you offer.
Matt
0
Pavel
Telerik team
answered on 09 Apr 2009, 05:50 AM
Hello Matt,

I am glad you were able to resolve the problem. We will investigate this issue further and see if we can isolate its cause. Let us know if you stumble upon any other problems.

Regards,
Pavel
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Input
Asked by
EmpowerIT
Top achievements
Rank 2
Answers by
EmpowerIT
Top achievements
Rank 2
Pavel
Telerik team
Giuseppe
Telerik team
Michael Iannone
Top achievements
Rank 1
Sebastian
Telerik team
Matt
Top achievements
Rank 1
Share this question
or