iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I use WebGrid 8.0.7200.253 RunTime version v2.0.50727.
In my application the decimal separator is "," but in one cell (the discount) i need to have the "." separator ( we need to use discount with numeric after "." for example 33.33) but the customer can insert in the cell both separator "," and "." (in case he insert the "," i replace with the ".").
My aspx page contain this code
<ISWebGrid:WebGridColumn Caption="Discount1" DataMember="speedy_discount1" DataType="System.Decimal" Name="speedy_discount1" Width="95px" DataFormatString="n" EditType="Custom" CustomEditorName="NumericUpDown" InputRequired="False" DefaultText="0" DefaultValue="0" CustomEditorProperties="MinValue=0;MaxValue=100"> <CellStyle HorizontalAlign="Right"> </CellStyle> </ISWebGrid:WebGridColumn>
This is the part of the javascript code i use to get the value
function WebGrid1_OnExitEditMode(controlId, tblName, editObject) {
.....
var objectObjectValue; var colObj = wgGetColumnByElement(editObject.cellElement); var CustomEditorName = colObj.CustomEditorName; var CustomEditorObj = grid.CustomEditors[CustomEditorName].ImplementationObject; objectObjectValue = CustomEditorObj.GetValue();
....}
In my old version of WebGrid (7.0.7200.403) i don't have this problem and i get the correct value of the object with this simple javascript
var objectObjectValue = editObject.element.value;
if i insert the value 33,33 i get 33,33 and after i can replace "," with ".".
Any one can help me
Thanks in Advance
armore1972
Hi armore1972,
I can replicate your issue in my local end. Probably, there are enhancement or fixing in NumericUpDown custom editor that changing the method to get text or value of input element inside NumericUpDown Custom Editor. However, you still can get decimal value from inputbox. Here's the method:
WebGrid1.CustomEditors["NumericUpDown"].ImplementationObject.GetBaseEditorElement().value
You will get the direct value of input element with that method. Hope this helps.
Regards,Bernard
Hi Bernards,Thanks for your help but i have another problem about this:Now i get the value by thisobjectObjectValue = CustomEditorObj.GetBaseEditorElement().value; but if i try to update this value in the component objectObjectValue = objectObjectValue.replace(',', '.');the application show the same the wrong value 3,333.00.I need to show the correct value (33.33 or 33,33), i suppose che CustomEditor has another Elementthat contain the value 3,333.00 for example.
After the customer has enter a discount value with ',' (for example 33,33) he must press tab or enter key the focus go to the Note Cell, i should replace the ',' with '.' before the Cell will be processed by CustomEditor ( in this way is like the user has enter 33.33 instead 33,33).
If is possibile can you help me about this implementation?
thanks in advanceArmore1972
You can get the data in OnExitEditMode client side events. However, you should change the data OnBeforeAdd client side events. In OnBeforeAdd event, you can get the data that would be inserted to database. Here's the snippet code how to do this scenario:
<script type="text/javascript"> var goodfloat; function OnExitEditMode(controlId, tblName, editObject) { var WebGrid1 = ISGetObject(controlId); var customEditorName = editObject.ToCellObject().Column.CustomEditorName; if (customEditorName != "") { var customEditorObject = WebGrid1.CustomEditors[customEditorName].ImplementationObject; var float = customEditorObject.GetBaseEditorElement().value; goodfloat = parseFloat(float.replace(',', '.')); } return true; } function OnBeforeAdd(controlId, tblName, rowObject) { var WebGrid1 = ISGetObject(controlId); rowObject.Cells[2].Value = goodfloat; rowObject.Cells[2].Text = goodfloat; return true; } </script>
Hope this helps.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname