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

Jquery AutoComplete Using RadTextBox

1 Answer 187 Views
Input
This is a migrated thread and some comments may be shown as answers.
Muhammad
Top achievements
Rank 1
Muhammad asked on 15 Mar 2012, 01:00 PM
Hi,

I am using Radtooltip and under that I have placed a RadText box control.

Basically I want to use Jquery Autocomplete to fetch the data for my Radtextbox using wcf web service. The webservice returns that data but the problem is that I can't use autocomplete operation for my radtextbox because Jquery works on HTML element. Is there any client side function which I can use to get the html element Id of my radtextbox.

<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">

    function GetJobs(sender, args) {

        var s = new PS.PSService();
        s.GetJobs(function (data) {
            $(sender).autocomplete({
                source: data,
                minLength: 2
            });

        });
    }        
</script>



<
telerik:RadToolTip ID="rttMore" runat="server" TargetControlID="tbSearch" EnableEmbeddedBaseStylesheet="true"
                                                            RelativeTo="Element" ShowCallout="true" HideDelay="4000" HideEvent="LeaveTargetAndToolTip"
                                                            Position="BottomCenter" Width="500px" Height="90px">
                                                            <fieldset id="fsMain" runat="server">
                                                                <legend class="fieldsetLegend" id="fslgndMain" runat="server">Select Filter </legend>
                                                                <asp:Panel ID="pnlSearch" runat="server" DefaultButton="btnGoSearchByJobName">
                                                                    Search by job <b>name / number</b>
                                                                    <telerik:RadTextBox ID="tbSearchByJobName" MaxLength="50" EmptyMessage="Leave empty for all jobs or enter a Job Name / Job No (Press Enter Key for search)"
                                                                        Width="430px" runat="server">
                                                                        <ClientEvents OnLoad="GetJobs" />
                                                                    </telerik:RadTextBox>
                                                                    <asp:RegularExpressionValidator ID="valSearch" runat="server" ForeColor="Red" Display="Dynamic"
                                                                        ErrorMessage="Please enter a valid Job Name / Job Number" ControlToValidate="tbSearchByJobName"
                                                                        ValidationExpression="[a-zA-Z|\d|\s]*"></asp:RegularExpressionValidator>
                                                                    <asp:Button ID="btnGoSearchByJobName" runat="server" Text="Go" OnClick="btnGoSearchByJobName_Click" />
                                                                    <br />
                                                                </asp:Panel>
                                                            </fieldset>
                                                        </telerik:RadToolTip>

1 Answer, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 15 Mar 2012, 01:33 PM
Hello Muhammad,

To get the RadTextBox's input element, you use sender.get_element(). Also, the AutoComplete feature you're using could easily be done with the RadComboBox and LoadOnDemand, which can be linked to a WCF Web Service. You can also control the minimum amount of characters to type by the using the MinFilterLength property of the RadComboBox.

Link to RadComboBox - WCF Service Demo:
http://demos.telerik.com/aspnet-ajax/combobox/examples/loadondemand/wcf/defaultcs.aspx

I hope that helps.
Tags
Input
Asked by
Muhammad
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Share this question
or