Hi,
I have a page with a WebNumericEdit control and a grid....
a column with diferent values (1 ... 0,25 ... 0,345678952315 ... 1,05498 ... 400 ...)
I want that when the user enters the page,
the values presented to him be with, let's say, max of 3 decimal digits (in the example above 1 ... 0,25 ... 0,345 ... 1,054 ... 400) and when he enters edit mode, the hole cell value be showed to him...That's the normal behaviour off the grid by using it's column format property..
But I also need that the user see the cell value with a certain cultureInfo....I do that by using a NumericEditControl and then the column shows the hole value all the time.
Any Ideas???
Obs.: I have the following code in UltraWebGrid initialize Layout for the user to see the number formated in his CultureInfo when in editMode:
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("pt-BR"); ci.NumberFormat.NumberDecimalSeparator = ",";
//Set this property because if not, only 2 digits are showned
ci.NumberFormat.NumberDecimalDigits = 20; WebNumericEdit1.NumberFormat = ci.NumberFormat;
UltraWebGrid1.DisplayLayout.AllowUpdateDefault = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes; UltraWebGrid1.Columns[1].Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom; UltraWebGrid1.Columns[1].EditorControlID = WebNumericEdit1.UniqueID;
There are 2 similar editors Infragistics.Web.UI.EditorControls.WebNumericEditor and Infragistics.WebUI.WebDataInput.WebNumericEdit which are located in different dlls and target different base classes.The architecture of editors for UltraWebGrid are based on embedded-editor interface, which is defined in shared dll. That dll is shared by controls located in Infragistics.WebUI, such as UltraWebGrid, WebTextEdit, WebDateChooser, etc. So, you need to replace Infragistics.Web.UI.EditorControls.WebNumericEditor by Infragistics.WebUI.WebDataInput.WebNumericEdit.
The default tagname if that editor is igtxt, so it will probably appear in asxp as<igtxt:WebNumericEdit ID="WebNumericEdit1" runat="server"></igtxt:WebNumericEdit>
Note: the WebNumericEditor belongs to Infragistics.Web.UI which contains AJAX controls and located in a single dll. It can be used by WebDataGrid as editor wrapped into EditorProvider.
Hi, I am trying to implement a WebNumericEditor for an UltraWebGrid. I need to prevent users from entering characters into a numeric cell. I tried to manually validate it via javascript but it seems like Ultrawebgrid numeric columns auto-convert invalid characters to 0 so I never tell if they accidentally hit a character or meant to enter a 0 anyway.
I'm using these versions of Infragistics
So far my understanding of how editors work is to drop and editor on the page like so
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<ig:WebNumericEditor ID="WebNumericEditor1" runat="server" DataMode="Decimal" MinValue="0" MaxValue="100"></ig:WebNumericEditor>
And then at the column I reference the editor right?
<igtbl:UltraGridColumn BaseColumnName="[col name]" EditorControlID="WebNumericEditor1"></igtbl:UltraGridColumn>
But I seem to get this message instead.
System.Exception: The control ctl00$ContentPlaceHolder1$WebNumericEditor1 references a control that does not implement IProvidesEmbeddableEditor and cannot be used as the editor control for column ctl00xContentPlaceHolder1xUltraWebGrid1_c_0_32
So far I've seen other forum posts use it successfully. So what exactly am I doing wrong?
Hi guys,
The solution propesed by Viktor Snezhko works pretty well.
You only need to add the next code in order to set/get the value in the grid control (in my case the decimals are delimited with coma that's why i use the replace).
function AfterEnterEditModeHandler(gridName, itemName) { //debugger; // Begin custom code to support Excel like float numbers var oCell = igtbl_getCellById(itemName); var valCell = new Number(oCell.getValue()); oCell.Band.Grid._editorCurrent.value = valCell.toString().replace(".", ","); // End custom code to support Excel like float numbers } function BeforeExitEditModeHandler(gridName, itemName) { //debugger; // Begin custom code to support Excel like float numbers var oCell = igtbl_getCellById(itemName); oCell.setValue(oCell.Band.Grid._editorCurrent.value, false); // End custom code to support Excel like float numbers }
Success!!
I tried to customize format/pattern/etc of WebNumericEdit - but unsuccessfully.
I am sorry for not clear explains of the problem.
I have a page with wNumEdit1 as WebNumericEdit control.
For example, user inputs number 123.123456 into wNumEdit1 and go to next field. I need that the text in the wNumEdit1 field shown as a 123.1235 ( rounded to 4 digits ) , but value remains = 123.123456.
If the user moves in the wNumEdit1 field that it again sees whole value 123.123456 for editing.
That is, control should show number in two formats. In "show" mode - as formated rounded number, in "edit" mode - whole number.
Now I try to format a wNumEdit1 control's text in onblur handler:
function WebNumEdit_TextFormat(oEdit) { // onblur handler setTimeout("FormatNumText('"+oEdit.ID+"');", 100); } function FormatNumText(numEdID) { var numEdCtrl = igedit_getById(numEdID); if (numEdCtrl) { var valTxt = numEdCtrl.text; var dot = valTxt.indexOf('.'); if(dot > 0 && dot + 5 < valTxt.length) { valTxt = numToStrFormat(numEdCtrl.value, 4); numEdCtrl.text = valTxt; numEdCtrl.repaint(); } } }
I will be grateful for any ideas.
To customize format/pattern/etc of WebNumericEdit you do not need to override anything. You can create a NumberFormatInfo object with disired properties and set it to NumberFormat property of control (similar to codes in the very first email or NetAdvantage samples related to culture formats).