RadGrid WebuserControl Find RadNumericTextBox

2 posts, 0 answers
  1. John
    John avatar
    5 posts
    Member since:
    Aug 2015

    Posted 11 Oct Link to this post

    I have a Radgrid that when the EditCommandColumn button is clicked I load a WebUserControl.

                                                                           <EditFormSettings  UserControlName="BudgetItemControl.ascx" EditFormType="WebUserControl">
                                                                                <EditColumn UniqueName="EditCommandColumn1">
                                                                                </EditColumn>
                                                                                <PopUpSettings Modal="false" />
                                                                            </EditFormSettings>

     

    On the WebUserControlI have the following bound field...

                                <telerik:RadNumericTextBox ID="txtQty" runat="server"  Text='<%# DataBinder.Eval(Container, "DataItem.Qty") %>' DisabledStyle-                 

                                    BackColor="Transparent" 
                                    EmptyMessage="Enter qty" Enabled="true" Font-Names="Arial" Font-Size="Small" ForeColor="#666699" MinValue="0"

                                    RenderMode="Lightweight" 
                                    Skin="Silk" TabIndex="7" Type="Number" Value="0" Width="190px" Visible="true"
                                    onkeyup="javascript: onChange();" onkeypress="return isFloatNumber(this,event);" >

    On the form with the grid I have the javascript OnChange() event

    when I try to get_value

    var txt=$find("<%= RadGrid1.ClientID%>").get_masterTableView().get_dataItems()[1].findControl("txtqty")

    I receive the following error: Cannot read property 'findControl' of undefined.

    I can get the value when using an asp control.

    var txt1 = document.getElementById("TextBox2").value; (THIS WORKS)

    How can I get the RadNumericTextBox value?

     

     

     

     

     

  2. Eyup
    Admin
    Eyup avatar
    3867 posts

    Posted 16 Oct Link to this post

    Hi John,

     

    To achieve this requirement, you can use the get_editItems() method instead of get_dataItems(). Then, you can use the $telerik.findControl() method by passing the get_editItems()[0].get_editFormItem() contaoner as the first argument:
    https://www.telerik.com/support/kb/aspnet-ajax/details/access-telerik-controls-on-client-side

    You can find a similar implementation using these methods here:
    https://www.telerik.com/support/kb/aspnet-ajax/grid/details/set-focus-to-a-control-in-popup-edit-form-of-radgrid

    I hope this will prove helpful. Feel free to give it a try and let me know about the result.

     

    Regards,
    Eyup
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top