Rank: Advanced Member Groups: Member
Joined: 5/15/2013 Posts: 34
|
Hi, I'm having problems with the Edit Mask control. test1: Initialize on page load with 2558.00 and displays ok. Post back the page without any changes the mask edit returns 255.00 Test2: I enter 1500 -- and when posts back to server the value is 150.00 Test3: I enter 47.3 -- and when posts back to server the value is 4.30 it seems the unit digit is getting dropped..... attached is a example page which show the problem. test versions: EO.Web 11.0.18.2 ASP.NET 4.0 IE10
Code: HTML/ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test Mask Edit</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<eo:MaskedEdit ID="MaskedEdit1" runat="server" Width="80px" PromptChar=" " CssClass="eoMaskNumber">
<eo:MaskedEditSegment Decimals="2" Mask="99990.00" MaxValue="99999.99" SegmentType="Number" />
</eo:MaskedEdit>
<br />
<br />
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="PostBack" />
</div>
</form>
</body>
</html>
Code: C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Decimal dv = 2558.00m;
String txt = dv.ToString ("F2");
MaskedEdit1.Text = txt;
}
Literal1.Text = MaskedEdit1.Text;
}
}
Code: CSS
.foo{}
.eoMaskNumber
{
text-align: right;
font-family: Courier New;
}
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
Please change your MaxValue from "99999" to "99999.99". The reason is we use MaxValue to calculate number of digits the MaskedEdit should have. When MaxValue is set to "99999", we concluded that the MaskedEdit should have 5 integer digits, which is correct. However when MaxValue is set to "99999.99", due to the way browser handles floating numbers, it actually changes to "100000.98" when the same value is seen by our code. Based on that value we conclude the MaskedEdit should have 6 integer digits, which causes it to drops one digits off when the value is sent back to the server side.
When you use "99999", internally we automatically consider the decimal part ".99". So even if you only set MaxValue to "99999", it will still behave as if MaxValue was "99999.99".
Thanks!
|
Rank: Advanced Member Groups: Member
Joined: 5/15/2013 Posts: 34
|
Thanks for the replay.
The only thing is that I think you flipped the values in your response.
My current MaxValue is 99999.99 so your from and to are reversed.
Reading your explanation it all makes sense.
I changed my MaxValue from 99999.99 to 99999 and works fine -- thanks again.....
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
OK. Glad that it works for you.
Thanks!
|