Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Input > ERROR: Object doesn't support this property or method java script
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Answered ERROR: Object doesn't support this property or method java script

Feed from this thread
  • wan avatar

    Posted on Feb 5, 2011 (permalink)

    I try to calculate amount=productPrice*qty but javascript error: Object doesn't support this property or method java script 
    at --> "text1 = $find(productPrice);" After that error I try to alert(text1) and it return NULL

    please help

    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
    <script type="text/javascript"
        function calculate(productPrice, qty, amount) { 
            var text1 = $find(productPrice);  
            var text2 = $find(qty); 
            var text3 = $find(amount); 
            var total = parseInt(text1.getvalue()) * parseInt(text2.getvalue()); 
            text3.setvalue(total); 
        }    
    </script
    </telerik:RadCodeBlock
        
        <telerik:RadGrid ID="RadGrid1" runat="server" 
                        AllowAutomaticDeletes="True"
                        AllowAutomaticUpdates="True"
                        AllowAutomaticInserts="True"  AllowPaging="True"
                        AutoGenerateColumns="False" ShowFooter="true"
                        GridLines="None" Width="100%" Skin="WebBlue"
                    <PagerStyle Mode="NextPrevAndNumeric" /> 
                    <MasterTableView DataKeyNames="saleOrderNo" NoMasterRecordsText="No records to display."
                            AutoGenerateColumns="false" CommandItemDisplay="Top" Name="SaleOrder"
                            EditMode="InPlace"
                        <Columns
                            <telerik:GridEditCommandColumn ButtonType="ImageButton"  UniqueName="EditCommandColumn_SaleOrder"
                                <ItemStyle CssClass="MyImageButton" /> 
                            </telerik:GridEditCommandColumn
                                
                            <telerik:GridBoundColumn DataField="productNo" DefaultInsertValue="" 
                                HeaderText="productNo" SortExpression="productNo" 
                                UniqueName="productNo" ReadOnly="True" Display="false"
                            </telerik:GridBoundColumn
                            <telerik:GridTemplateColumn DataField="productName" DefaultInsertValue="" 
                                HeaderText="productName" SortExpression="productName" UniqueName="productName"
                                <EditItemTemplate
                                    <telerik:RadComboBox ID="RadComboBox_Product" Runat="server" 
                                            DataSourceID="SqlDataSource_ddlProduct" DataTextField="productName"
                                            DataValueField="productNo" AppendDataBoundItems="true"
                                            AllowCustomText="true" Skin="WebBlue" Filter="Contains" 
                                            selectedvalue='<%# Bind("productNo") %>' AutoPostBack="true" 
                                            onselectedindexchanged="RadComboBox_Product_SelectedIndexChanged" > 
                                        <Items
                                            <telerik:RadComboBoxItem Text="--Please Select--" Value="" Selected="true"/>      
                                        </Items
                                    </telerik:RadComboBox
                                    <asp:RequiredFieldValidator runat="server" ValidationGroup="InGrid"
                                            ID="ReqFieldValidate_ddlPrd" ControlToValidate="RadComboBox_Product"
                                            ErrorMessage="*" Display="Dynamic" InitialValue="--Please Select--" /> 
                                </EditItemTemplate
                                <ItemTemplate
                                    <asp:Label ID="productNameLabel" runat="server" 
                                        Text='<%# Eval("productName") %>'></asp:Label
                                </ItemTemplate
                            </telerik:GridTemplateColumn
                            <telerik:GridTemplateColumn DataField="productPrice" DefaultInsertValue="" ItemStyle-HorizontalAlign="Right"
                                HeaderText="productPrice" SortExpression="productPrice" UniqueName="productPrice" ItemStyle-Width="120px"
                                <EditItemTemplate
                                    <asp:TextBox ID="txtProductPrice" runat="server" Enabled="false" Width="120px"
                                        Text='<%# Bind("productPrice", "{0:N}") %>'></asp:TextBox
                                </EditItemTemplate
                                <ItemTemplate
                                    <asp:Label ID="productPriceLabel" runat="server" 
                                        Text='<%# Eval("productPrice", "{0:N}") %>'></asp:Label
                                </ItemTemplate
                                <ItemStyle HorizontalAlign="Right" Width="120px"></ItemStyle
                            </telerik:GridTemplateColumn
                            <telerik:GridTemplateColumn DataField="qty" DefaultInsertValue="" ItemStyle-HorizontalAlign="Right"
                                HeaderText="qty" SortExpression="qty" UniqueName="qty" ItemStyle-Width="120px"
                                <EditItemTemplate
                                    <asp:TextBox ID="txtQty" runat="server" Width="120px"
                                        Text='<%# Bind("qty", "{0:N}") %>'> 
                                    </asp:TextBox
                                    <%--<telerik:RadNumericTextBox ID="txtQty" runat="server" 
                                            DbValue='<%# Eval("qty") %>' Type="Number"> 
                                        <ClientEvents OnBlur="Blur" OnFocus="Focus" /> 
                                    </telerik:RadNumericTextBox>--%> 
                                </EditItemTemplate
                                <ItemTemplate
                                    <asp:Label ID="qtyLabel" runat="server" Text='<%# Eval("qty", "{0:N}") %>'></asp:Label
                                </ItemTemplate
                                <ItemStyle HorizontalAlign="Right" Width="120px"></ItemStyle
                            </telerik:GridTemplateColumn
                            <telerik:GridTemplateColumn DataField="amount" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="120px"
                                HeaderText="amount" SortExpression="amount" UniqueName="amount"
                                <EditItemTemplate
                                    <asp:TextBox ID="txtAmount" runat="server" Width="120px"
                                        Text='<%# Bind("amount", "{0:N}") %>' Enabled="false" > 
                                    </asp:TextBox
                                </EditItemTemplate
                                <ItemTemplate
                                    <asp:Label ID="lblAmount" runat="server" Text='<%# Eval("amount", "{0:N}") %>'></asp:Label
                                </ItemTemplate
                                <ItemStyle HorizontalAlign="Right" Width="120px"></ItemStyle
                            </telerik:GridTemplateColumn
                            <telerik:GridButtonColumn ConfirmText="Delete?"
                                                    ConfirmDialogType="RadWindow"
                                                    ConfirmTitle="Delete" ButtonType="ImageButton" 
                                                    CommandName="Delete" Text="Delete"
                                                    UniqueName="DeleteColumn_SaleOrder"
                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> 
                            </telerik:GridButtonColumn
                        </Columns
                    </MasterTableView
                </telerik:RadGrid



    Private Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound 
        
            If TypeOf e.Item Is GridDataItem AndAlso e.Item.IsInEditMode Then
                Dim dataItem As GridDataItem = DirectCast(e.Item, GridDataItem) 
                Dim txt_Price As TextBox = TryCast(dataItem("productPrice").FindControl("txtProductPrice"), TextBox) 
                Dim txt_Qty As TextBox = TryCast(dataItem("qty").FindControl("txtQty"), TextBox) 
                Dim txt_Amount As TextBox = TryCast(dataItem("amount").FindControl("txtAmount"), TextBox) 
        
                txt_Price.Attributes.Add("onFocusout", "return calculate('" & txt_Price.ClientID & "','" & txt_Qty.ClientID & "','" & txt_Amount.ClientID & "')"
                txt_Qty.Attributes.Add("onFocusout", "return calculate('" & txt_Price.ClientID & "','" & txt_Qty.ClientID & "','" & txt_Amount.ClientID & "')"
                txt_Amount.Attributes.Add("onfocus", "return calculate('" & txt_Price.ClientID & "','" & txt_Qty.ClientID & "','" & txt_Amount.ClientID & "')"
            End If
        
    End Sub

  • Answer Shinu MVP avatar

    Posted on Feb 7, 2011 (permalink)

    Hello,


    For getting reference to normal TextBox, use 'document.getElementById()'  method than using $find(). $find() is used for getting reference to ajax enabled controls.


    In order to set/get value, use text1.value if using <asp:TextBox>.

    In the case of
    using RadNumericTextbox, you need to use set_value()/get_value() as shown in the documentation.
     RadNumericTextBox Client Object



    -Shinu.

  • wan avatar

    Posted on Feb 7, 2011 (permalink)

    many thnaks for your help
    It worked !!!

    :)

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Input > ERROR: Object doesn't support this property or method java script