How do you use the ValueChanging event from inside an EditorProvider
I have defined an EditProvider
<ig:TextEditorProvider ID="tepPercent">
<EditorControl HorizontalAlign="Right" ClientEvents-ValueChanging="validatePercent4Decimals"></EditorControl>
</ig:TextEditorProvider>
And a javascript handler
function validatePercent4Decimals(sender, args) {
var oldfieldvalue = args.get_oldValue();
var newfieldvalue = args.get_value();
if (isNaN(newfieldvalue)) {
args.set_value(oldfieldvalue);
args.set_cancel(true);
}
I've debugged it and can see it is running, and if I enter 34r, the inNan tests true and the set_value and set_cancel are called. But the value on the grid does not change from the 34r...
What's going on?
Hello bixbarton ,
Thank you for posting in our forums.
I tried to reproduce the issue with the latest service release of v11.1 ( 11.1.20111.2064) but with no avail.
I strongly recommend you installing it.
The newly entered value is removed and the old value is restored
<EditorProviders>
<ig:TextEditorProvider ID="whdg1_TextEditorProvider1">
<EditorControl runat="server">
<ClientEvents ValueChanging="whdg1_TextEditor_ValueChanging" />
</EditorControl>
</EditorProviders>
….
<ig:BoundDataField DataFieldName="ItemParent" Key="ItemParent" Header-Text="ItemParent">
<Header Text="ItemParent"></Header>
</ig:BoundDataField>
<ig:CellEditing>
<ColumnSettings>
<ig:EditingColumnSetting ColumnKey="ItemParent" EditorID="whdg1_TextEditorProvider1" />
</ColumnSettings>
</ig:CellEditing>
What is the type of the column that you are setting the editor provider to?
Hope hearing from you.
Hi Tsvetelina
In your code you have a runat="server" in the EditorControl element. The event is being used clientside, not serverside. Is this required? I don't have that.
Thank you for the clarification.
When using Numeric data ( Decimal, Int ,etc ) WebDataGrid internally uses NumericEditorProvider
http://help.infragistics.com/NetAdvantage/ASPNET/2011.1?page=WebDataGrid_Editor_Providers.html
The column type should be System.String in order to use TextEditorProvider.
Don't you receive error like this?
Editor with ID: whdg1_TextEditorProvider1 cannot edit column with Key:Salary.
The editor does not support the column type.
Hi Tsvetelina, I will put together a sample as soon as I can.
In the meantime, the type of the column is System.Decimal
This element is not required and I was not able to reproduce the issue after removing it.
Would you be able to provide us with isolated sample replicating the behavior?