RadNumericTextBoxes in EditTemplates firing wrong event

2 posts, 0 answers
  1. Danny
    Danny avatar
    35 posts
    Member since:
    May 2012

    Posted 06 Nov 2014 Link to this post

    I have two numeric textboxes in edit templates, one will need to be updated in the edit form if the other is changed and vice-versa. 

    If I set their OnTextChanged arguments in the page markup, like so-

    <telerik:GridTemplateColumn UniqueName="curr_tons_ord" SortExpression="curr_tons_ord" HeaderText="Tons" HeaderStyle-Width="70px" FilterControlAltText="Filter curr_tons_ord column" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right">
                           <ItemTemplate>
                               <asp:Literal runat="server" ID="lit_curr_tons_ord" Text='<%# (Eval("curr_tons_ord")) %>'   />
                           </ItemTemplate>
                           <EditItemTemplate>
                              <telerik:RadNumericTextBox runat="server" ID="tb_curr_tons_ord" Value='<%# Convert.ToDouble(Eval("curr_tons_ord")) %>' NumberFormat-DecimalDigits="1" Width="55px" EnabledStyle-HorizontalAlign="Right" AutoPostBack="true" OnTextChanged="tb_curr_tons_ord_TextChanged"></telerik:RadNumericTextBox>
                           </EditItemTemplate>
                       </telerik:GridTemplateColumn>
                       <telerik:GridTemplateColumn UniqueName="curr_rolls_ord" SortExpression="curr_rolls_ord" HeaderText="Rolls" HeaderStyle-Width="70px" FilterControlAltText="Filter curr_rolls_ord column" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right">
                           <ItemTemplate>
                               <asp:Literal runat="server" ID="lit_curr_rolls_ord" Text='<%# Eval("curr_rolls_ord") %>'   />
                           </ItemTemplate>
                           <EditItemTemplate>
                              <telerik:RadNumericTextBox runat="server" ID="tb_curr_rolls_ord" Value='<%# Convert.ToDouble(Eval("curr_rolls_ord")) %>' NumberFormat-DecimalDigits="0" Width="55px" EnabledStyle-HorizontalAlign="Right" AutoPostBack="true" OnTextChanged="tb_curr_rolls_ord_TextChanged"></telerik:RadNumericTextBox>
                           </EditItemTemplate>
                              </telerik:GridTemplateColumn>


    the tb_curr_tons_ord_TextChanged event fires, even if I do not touch tb_curr_tons_ord and only enter data in the tb_curr_rolls_ord.  Then the tb_curr_rolls_ord_TextChanged event fires, immediately afterwards.

    If I then attempt to edit tb_curr_rolls_ord a second time, then only tb_curr_rolls_ord_TextChanged fires.   This behavior is exact completely repeatable.  

    I tried setting the events in the OnItemDataBound event instead of the page markup,  but although I was able to successfully change the AutoPostBack property, I was unable to get either method to fire in this circumstance.  




    I'm using version 2013.3.1324.40
  2. Danny
    Danny avatar
    35 posts
    Member since:
    May 2012

    Posted 06 Nov 2014 in reply to Danny Link to this post

    Wow, no edit function, anymore?   Apologies for typos in the previous post.  Here's the onitemdatabound methods-

    GridEditableItem item = (GridEditableItem)e.item;
      
    RadNumericTextBox tb_curr_tons_ord = (RadNumericTextBox)item.FindControl("tb_curr_tons_ord");
    RadNumericTextBox tb_curr_rolls_ord = (RadNumericTextBox)item.FindControl("tb_curr_rolls_ord");
      
    tb_curr_rolls_ord.AutoPostBack = true;
    tb_curr_tons_ord.AutoPostBack = true;
      
    tb_curr_rolls_ord.TextChanged += new EventHandler(tb_curr_rolls_ord_TextChanged);
    tb_curr_tons_ord.TextChanged += new EventHandler(tb_curr_tons_ord_TextChanged);

    Again, the events don't fire at all using this method. 
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top