This is a migrated thread and some comments may be shown as answers.

Nestedviewtemplate textbox textchanged event.

1 Answer 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 12 May 2012, 10:42 AM
Hi,

I have the below show MasterViewtable and NestedViewtable in my radgrid...



 STEP 1 -   I have attached textchanged event for all nestedview textboxes in OnItemCreated

 protected void rdgEmployee_OnItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridNestedViewItem)
            {
                GridNestedViewItem item = (GridNestedViewItem)e.Item;

                //MeritPerc
                RadNumericTextBox txtPropIncrease = (RadNumericTextBox)item.FindControl("txtPropIncrease");
                txtPropIncrease.TextChanged += new EventHandler(txtPropIncrease_TextChanged);
            }
        }

 STEP 2 - On the nesteview textbox textchanged event, i am getting griddataitem and manipulating my data based on that item.

protected void txtPropIncrease_TextChanged(object sender, EventArgs e)
        {
            RadNumericTextBox txtPropIncrease = sender as RadNumericTextBox;
            GridNestedViewItem Childitem = (GridNestedViewItem)txtPropIncrease.NamingContainer;
            GridDataItem parentItem = Childitem.ParentItem;

            CalculateCompensationByComponent(parentItem, GridOperationType.MeritPercent, txtPropIncrease);
        }


 PROBLEM :   When i change the first textbox value, the respected textbox extchanged event calling,  but after changing first textbox value, i am trying to change the second textbox value, its suppose to call the second textbox textchanged event, its doing as expected, but it calling first textbox textchanged event before calling the its respected ( second textbox ) textchanged event.

Could you please help on this ?  Why its calling the first textbox change event, even though i didn't change the value of it. ?

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 17 May 2012, 12:22 PM
Hi Ram,

The TextChanged event is fired only when the value received on the PostBack is different than the value previously sent from server to the browser.

So the TextChanged will be fired for the first TextBox in the second PostBack if you changed ClientSide. It actually can be done automatically if you have the AllowRounding turned of or you don't keep the rounded value, for some reason (less decimal digits, additional formatting, etc). In this cases the value has changed and the TextChanged event will be fired.

Kind regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Ram
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or