in Education by
The RangeValidator will fetch the value of the input and validate it with regex. Part of the regex is the localized decimal character. So, in the German culture the RangeValidator will fail if I enter 100.00, however it will accept 100,00, because , is the decimal character of the German culture. On the new input[type=number] (asp:TextBox with TextMode="Number") of HTML5, I can enter 100,00 or 100.00 (with the stepattribute set to "0.01" and it will always hold the value 100.00. This will cause the RangeValidator to fail all the time in the German culture. Changing the location to en-US would solve the problem, but I need the application in the users locale. Can I, somehow, tell the RangeValidator to always use . as decimal character or are there any better ways to handle this situation? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You can set the specific number format settings on Page_PreInit and change the decimal separator without changing the whole UI language. protected void Page_PreInit(object sender, EventArgs e) { CultureInfo newCulture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); NumberFormatInfo numberFormat = (NumberFormatInfo)newCulture.NumberFormat.Clone(); numberFormat.NumberDecimalDigits = 2; numberFormat.NumberDecimalSeparator = "."; newCulture.NumberFormat = numberFormat; System.Threading.Thread.CurrentThread.CurrentCulture = newCulture; }

Related questions

0 votes
    I have a bunch of action methods inside my controller each with its own model binded as input parameter es ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    I can't use Microsoft's Web Platform Installer to install webmatrix. The error message is "Web Platform ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    In ASP.NET, if I databind a gridview with a array of objects lets say , how can I retrieve and ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 16, 2022 in Education by JackTerrance
0 votes
    I am running aspnet_compiler as a post-build event, using the following command: aspnet_compiler.exe -v / - ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    Background: I have an old web CMS that stored content in XML files, one XML file per page. I am ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 10, 2022 in Education by JackTerrance
0 votes
    I'm building an app using Visual Studio 2010. I can run my asp.net website from my computer (by ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    I am refactoring some CSS on a website. I have been working on, and noticed the absence of traditional ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    I am refactoring some CSS on a website. I have been working on, and noticed the absence of traditional ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    I know how to use the checkboxlist in ASP.NET to display options retrieved from a database. What I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    I have user control named DateTimeUC which has two textboxes on its markup: I am dynamically creating this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 13, 2022 in Education by JackTerrance
0 votes
    I have user control named DateTimeUC which has two textboxes on its markup: I am dynamically creating this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 13, 2022 in Education by JackTerrance
0 votes
    I have user control named DateTimeUC which has two textboxes on its markup: I am dynamically creating this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 13, 2022 in Education by JackTerrance
0 votes
    I've been struggling with some issues relating to referencing child controls within a FormView. Another developer ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
...