Nestedviewtemplate textbox textchanged event.

2 posts, 0 answers
  1. Ram
    Ram avatar
    8 posts
    Member since:
    Dec 2006

    Posted 12 May 2012 Link to this post

    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. ?
  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 17 May 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top