﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - How to limit entry in WebGrid to a range of decimal values?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-limit-entry-in-WebGrid-to-a-range-of-decimal-values/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>How to limit entry in WebGrid to a range of decimal values?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-limit-entry-in-WebGrid-to-a-range-of-decimal-values/</link><pubDate>Wed, 30 May 2012 23:26:53 GMT</pubDate><dc:creator>Hans</dc:creator><category>WebGrid</category><category>data entry</category><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You could use “OnDirty” client side event in WebInput.&lt;br /&gt;However, you should use “setTimeout” function in that event.&lt;br /&gt;Here’s the example snippet code, how to use “OnDirty” event:&lt;/p&gt;&lt;pre&gt;function WebInput1_OnDirty(controlId, dirtySourceType) {
    var WebInput1 = ISGetObject(controlId);
    window.setTimeout(function () { Validate(WebInput1.GetValueData(true)); }, 300);
    return true;
}

function Validate(value) {
    // your validation
}&lt;/pre&gt;
Hope this helps.&lt;br /&gt;Thank you.&lt;br /&gt;Regards,&lt;br /&gt;Hans. 
&lt;p&gt; &lt;/p&gt;</description></item><item><title>How to limit entry in WebGrid to a range of decimal values?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-limit-entry-in-WebGrid-to-a-range-of-decimal-values/</link><pubDate>Wed, 30 May 2012 09:57:45 GMT</pubDate><dc:creator>qafrank1</dc:creator><category>WebGrid</category><category>data entry</category><description>&lt;p&gt;Is there a way to place a range checker on the WebInput control?&lt;/p&gt;
&lt;p&gt;If it should be handled the same, what function would I override ? Is there a corresponding "OnAfterExitEditMode" for WebInput?&lt;/p&gt;</description></item><item><title>How to limit entry in WebGrid to a range of decimal values?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-limit-entry-in-WebGrid-to-a-range-of-decimal-values/</link><pubDate>Thu, 24 May 2012 21:51:55 GMT</pubDate><dc:creator>Hans</dc:creator><category>WebGrid</category><category>data entry</category><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Yes, you could use this code. However, you should modify this code (the validation) according to your needs.&lt;/p&gt;
&lt;p&gt;I try to make an edit and leave the cell without making any changes, by using example project that I’ve gave to you in earlier post.&lt;br /&gt;But unfortunately, the value didn’t turn into “null”.&lt;/p&gt;
&lt;p&gt;Would you mind to tell me how to replicate this issue? There may be a setting that I miss, in my example project.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;br /&gt;Regards,&lt;br /&gt;Hans.&lt;/p&gt;</description></item><item><title>How to limit entry in WebGrid to a range of decimal values?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-limit-entry-in-WebGrid-to-a-range-of-decimal-values/</link><pubDate>Thu, 24 May 2012 18:07:07 GMT</pubDate><dc:creator>qafrank1</dc:creator><category>WebGrid</category><category>data entry</category><description>&lt;p&gt;So, if I am using a grid with 6 different columns containing decimal types (currency), I need to write this code to handle culture settings?&lt;/p&gt;
&lt;p&gt;Also, when I "click-into" the cell to make an edit, then leave the cell without entering a change, the value is "null" - not the value that was originally in the cell. Why?&lt;/p&gt;</description></item><item><title>How to limit entry in WebGrid to a range of decimal values?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-limit-entry-in-WebGrid-to-a-range-of-decimal-values/</link><pubDate>Wed, 23 May 2012 22:19:47 GMT</pubDate><dc:creator>Hans</dc:creator><category>WebGrid</category><category>data entry</category><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;To resolve this issue, please replace the code in OnAfterExitEditMode to this code below:&lt;/p&gt;&lt;pre&gt;function WebGrid1_OnAfterExitEditMode(controlId, tableName, editObject) {
    var WebGrid1 = ISGetObject(controlId);
    var ColumnName = editObject.ToCellObject().Name;

    if (ColumnName == "UnitPrice") {
        var TextPrice = editObject.element.value;
        var IntPrice = parseFloat(TextPrice);
        if (IntPrice &amp;gt;= 100 || IntPrice &amp;lt; 0) {

            editObject.ToCellObject().SetText("0", true);
            editObject.ToCellObject().SetValue("0");
            alert("Invalid UnitPrice Value");
            return false;
        }
        else {
            editObject.ToCellObject().SetText(TextPrice.toString(), true);
            editObject.ToCellObject().SetValue(TextPrice.toString());
            return true;
        }
    }
}&lt;/pre&gt;
&lt;p&gt;Hope this helps. Thank you.&lt;br /&gt;Regards,&lt;br /&gt;Hans.&lt;/p&gt;</description></item><item><title>How to limit entry in WebGrid to a range of decimal values?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-limit-entry-in-WebGrid-to-a-range-of-decimal-values/</link><pubDate>Wed, 23 May 2012 10:26:01 GMT</pubDate><dc:creator>qafrank1</dc:creator><category>WebGrid</category><category>data entry</category><description>&lt;p&gt;I have a need to change the culture sometimes.&lt;/p&gt;
&lt;p&gt;In my example, if I change a value to "19,32", the grid changes it to "0". The javascript sees the value as "1932". How do I get this to work for an alternative culture? I still want the value to be saved to the database as "19.32".&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;</description></item><item><title>How to limit entry in WebGrid to a range of decimal values?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-limit-entry-in-WebGrid-to-a-range-of-decimal-values/</link><pubDate>Tue, 22 May 2012 23:51:23 GMT</pubDate><dc:creator>Hans</dc:creator><category>WebGrid</category><category>data entry</category><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;To apply this scenario, you should set DataFormatString to “##.##” and do some validation using OnAfterExitEditMode client side event.&lt;br /&gt;I’ve made a sample project that similar with this scenario.&lt;br /&gt;In my sample, I use Northwind.mdb database and Products table. Then, at UnitPrice column, I set DataFormatString to “##.##”.&lt;/p&gt;
&lt;p&gt;And here the validation code in WebGrid’s OnAfterExitEditMode event:&lt;/p&gt;&lt;pre&gt;function WebGrid1_OnAfterExitEditMode(controlId, tableName, editObject) {
    var WebGrid1 = ISGetObject(controlId);
    var ColumnName = editObject.ToCellObject().Name;
    if (ColumnName == "UnitPrice") {
        var TextPrice = editObject.ToCellObject().Text;
        var IntPrice = parseInt(TextPrice);
        if (IntPrice &amp;gt;= 100 || IntPrice &amp;lt; 0) {
            editObject.ToCellObject().SetText("0");
            editObject.ToCellObject().SetValue("0");
            alert("Invalid UnitPrice Value");
            return false;
        }
        else {
            return true;
        }
    }
}&lt;/pre&gt;

&lt;p&gt;I attached my sample as well, in order to make you easily understand about my sample.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;br /&gt;Regards,&lt;br /&gt;Hans.&lt;/p&gt;</description></item><item><title>How to limit entry in WebGrid to a range of decimal values?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-limit-entry-in-WebGrid-to-a-range-of-decimal-values/</link><pubDate>Tue, 22 May 2012 18:11:19 GMT</pubDate><dc:creator>qafrank1</dc:creator><category>WebGrid</category><category>data entry</category><description>&lt;p&gt;How can I define a range of acceptable values for data entry in the WebGrid? I want to limit both value and number of digits before and/or after the decimal.&lt;/p&gt;
&lt;p&gt;For example, I want to limit the data to values between 0.00 and 99.99 for a field.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;129.99 would not be acceptable&lt;/li&gt;&lt;li&gt;99.9043 would not be acceptable&lt;/li&gt;&lt;li&gt;0.003 would not be acceptable&lt;/li&gt;&lt;li&gt;0.34 would be acceptable&lt;/li&gt;&lt;li&gt;33.36 would be acceptable&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Thanks.&lt;/p&gt;</description></item></channel></rss>