ValueChanging event

Answered (Not Verified) This post has 0 verified answers | 5 Replies | 2 Followers Thread's RSS feed.

bixbarton
Points 215
Replied On: Mon, Oct 3 2011 11:05 AM Reply

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?

  • Post Points: 20

All Replies

Replied On: Tue, Oct 4 2011 9:08 AM Reply

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>

                </ig:TextEditorProvider>

            </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.

Kind Regards,

Tsvetelina Georgieva

Infragistics, Inc.

  • Post Points: 20
bixbarton
Points 215
Replied On: Tue, Oct 4 2011 11:26 AM Reply

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.

  • Post Points: 20
Replied On: Wed, Oct 5 2011 4:20 AM Reply

Hello bixbarton ,

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?

Hope hearing from you.

Kind Regards,

Tsvetelina Georgieva

Infragistics, Inc.

  • Post Points: 20
bixbarton
Points 215
Replied On: Wed, Oct 5 2011 6:07 AM Reply

Hi Tsvetelina, I will put together a sample as soon as I can.

 

In the meantime, the type of the column is System.Decimal


  • Post Points: 20
Answered (Not Verified) Replied On: Wed, Oct 5 2011 11:34 AM Reply

Hello bixbarton ,

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.

Hope hearing from you.

Kind Regards,

Tsvetelina Georgieva

Infragistics, Inc.

  • Post Points: 5
Page 1 of 1 (6 items) | RSS