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

Radgrid EditForm TextBox AutoComplete

1 Answer 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Indranil
Top achievements
Rank 1
Indranil asked on 22 Mar 2013, 06:45 AM
Hi all I have a Radgrid in my form . where i have a editform template . I have textbox control on it. I want to apply autocomplete on this textbox. But this is not working. i have tested it with another textbox outside the grid it is working. i am using Ajax and webservice for this.
i am taking class name for autocomplete operation in ajax. Please help.

i am attaching my code

$(function() {
       var x = document.getElementById("hid1").value;
       // alert(x);
       $(".aaa").autocomplete({
           source: function(request, response) {
               $.ajax({
                   url: "EmployeeList.asmx/FetchEmailList",
                   data: "{ 'mail123': '" + request.term + "' }",
                   dataType: "json",
                   type: "POST",
                   contentType: "application/json; charset=utf-8",
                   dataFilter: function(data) { return data; },
                   success: function(data) {
                       response($.map(data.d, function(item) {
                           return {
                               value: item.MenuName
                           }
                       }))
                   },
                   error: function(XMLHttpRequest, textStatus, errorThrown) {
                       alert(textStatus);
                   }
               });
           },
           minLength: 1
       });
   });


and the grid is

<telerik:RadGrid ID="RadGridNewApi" runat="server" GridLines="None"
                                                                    Skin="WebBlue" AllowPaging="false" AllowSorting="True" AutoGenerateColumns="False"
                                                                    OnNeedDataSource="RadGridNewApi_NeedDataSource" ShowStatusBar="true" AllowAutomaticDeletes="True"
                                                                    AllowAutomaticInserts="True" AllowAutomaticUpdates="True" OnItemCreated="ItemCreated">
                                                                    <MasterTableView CommandItemDisplay="Top" DataKeyNames="">
                                                                        <CommandItemSettings AddNewRecordText="Add Field" RefreshText=""></CommandItemSettings>
                                                                        <Columns>
                                                                            
                                                                            <telerik:GridBoundColumn UniqueName="MenuName" HeaderText="MenuName" DataField="MenuName">
                                                                                <HeaderStyle Width="60px"></HeaderStyle>
                                                                            </telerik:GridBoundColumn>
                                                                           
                                                                        </Columns>
                                                                        <EditFormSettings EditFormType="Template">
                                                                            <FormTemplate>
                                                                                <table id="Table9" cellspacing="5" cellpadding="5" width="97%" border="0" rules="none"
                                                                                    style="background: white;">
                                                                                    <tr>
                                                                                        <td>
                                                                                            <table id="Table7" cellspacing="5" cellpadding="5" width="100%" border="0" class="module">
                                                                                               
                                                                                                <tr>
                                                                                                    <td>
                                                                                                        Mask Name:
                                                                                                    </td>
                                                                                                    <td>
                                                                                                        <asp:TextBox runat="server" ID="txtMaskName" class="aaa" Text='<%# Bind("MenuName")%>' ></asp:TextBox>
                                                                                                    </td>
                                                                                                </tr>
                                                                                                
                                                                                    <tr>
                                                                                        <td align="right" colspan="2">
                                                                                            <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Add" : "Update" %>'
                                                                                                runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                                                                            </asp:Button>&nbsp;
                                                                                            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                                                                                CommandName="Cancel"></asp:Button>
                                                                                        </td>
                                                                                    </tr>
                                                                                </table>
                                                                            </FormTemplate>
                                                                        </EditFormSettings>
                                                                    </MasterTableView>
                                                                </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 27 Mar 2013, 09:26 AM
Hello Indranil,

To achieve the desired functionality you can try using our RadAutoCompleteBox control placed into the RadGrid template column. More information about RadAutoCompleteBox and how to bind it to web server you can find here:
http://demos.telerik.com/aspnet-ajax/autocompletebox/examples/populatingwithdata/defaultcs.aspx

I hope this helps.

Greetings,
Radoslav
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.
Tags
Grid
Asked by
Indranil
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or